使用经典asp读取html页面并将其插入数据库
我试图逐行读取包含其标记的html页面(文件),然后使用经典ASP将其插入数据库。我的问题是,我无法读取html标记,如使用经典asp读取html页面并将其插入数据库,html,database,file-io,replace,asp-classic,Html,Database,File Io,Replace,Asp Classic,我试图逐行读取包含其标记的html页面(文件),然后使用经典ASP将其插入数据库。我的问题是,我无法读取html标记,如 <p>Test</p> 尝试使用responseHTML而不是responseText: strArr = split(xmlhttp.responseHTML,vbcrlf) 试试这个: Dim url,strArr,xmlhttp,lineno url = "http://localhost/0/questions/q.htm
<p>Test</p>
尝试使用responseHTML而不是responseText:
strArr = split(xmlhttp.responseHTML,vbcrlf)
试试这个:
Dim url,strArr,xmlhttp,lineno
url = "http://localhost/0/questions/q.html"
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "GET", url, false
xmlhttp.send ""
strArr = split(xmlhttp.responseText,vbcrlf)
set xmlhttp = nothing
for lineno=0 to ubound(strArr)
response.write(Replace(strArr(lineno),"<","<'"))
next
Dim-url、strArr、xmlhttp、lineno
url=”http://localhost/0/questions/q.html"
设置xmlhttp=CreateObject(“MSXML2.ServerXMLHTTP”)
xmlhttp.open“GET”,url,false
xmlhttp.send“”
strArr=split(xmlhttp.responseText,vbcrlf)
设置xmlhttp=nothing
对于lineno=0到ubound(strArr)
响应。写入(替换)(strArr(行号),"你的代码按原样工作,我不知道你在问什么。很可能你在其他地方出错了。我刚刚获得了这个特定页面的HTML源代码,并使用你的代码和我的数据库连接将其写入数据库,没有任何问题。显示你的代码的确切位置,然后查看响应。写hello。我们在这里是为了好玩,但会很有趣如果你把帮助你的东西作为答案,而不仅仅是投票,那就好了。
strArr = split(xmlhttp.responseHTML,vbcrlf)
Dim url,strArr,xmlhttp,lineno
url = "http://localhost/0/questions/q.html"
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "GET", url, false
xmlhttp.send ""
strArr = split(xmlhttp.responseText,vbcrlf)
set xmlhttp = nothing
for lineno=0 to ubound(strArr)
response.write(Replace(strArr(lineno),"<","<'"))
next