利用ASP從遠程服務器上接收XML數(shù)據(jù)的方法
更新時間:2007年01月03日 00:00:00 作者:
復制代碼 代碼如下:
<%
dim objXML
dim objRootElement
dim strValue
dim strInetURL
dim strXML
dim item
strInetURL ="http://pf.inetsolution.com/inetactive2001/inetactive2001news.xml"
Dim HttpReq
set HttpReq = server.CreateObject("MSXML2.XMLHTTP")
HttpReq.open "GET", "http://pf.inetsolution.com/inetactive2001/inetactive2001news.xml", False
HttpReq.send
strXML = HttpReq.responseText
Set objXML = Server.CreateObject("Msxml2.DOMDocument")
objXML.validateonparse = true
objXML.async=false
objXML.loadXML(strXML)
if objXML.ParseError.errorCode <> 0 then
Response.Write("Error: " & objXML.parseError.reason & "<br>")
Response.Write("Code: 0x" & hex(objXML.parseError.errorCode) & "<br>")
Response.Write("At Line: " & objXML.parseError.line & "<br>")
Response.Write("At pos: " & objXML.parseError.linePos & "<br>")
else
set objRootElement = objXML.documentElement
if not isObject(objRootElement) then
Response.Write("no file loaded")
else
Response.Write(objRootElement.childnodes(0).text)
end if
end if
%>
dim objXML
dim objRootElement
dim strValue
dim strInetURL
dim strXML
dim item
strInetURL ="http://pf.inetsolution.com/inetactive2001/inetactive2001news.xml"
Dim HttpReq
set HttpReq = server.CreateObject("MSXML2.XMLHTTP")
HttpReq.open "GET", "http://pf.inetsolution.com/inetactive2001/inetactive2001news.xml", False
HttpReq.send
strXML = HttpReq.responseText
Set objXML = Server.CreateObject("Msxml2.DOMDocument")
objXML.validateonparse = true
objXML.async=false
objXML.loadXML(strXML)
if objXML.ParseError.errorCode <> 0 then
Response.Write("Error: " & objXML.parseError.reason & "<br>")
Response.Write("Code: 0x" & hex(objXML.parseError.errorCode) & "<br>")
Response.Write("At Line: " & objXML.parseError.line & "<br>")
Response.Write("At pos: " & objXML.parseError.linePos & "<br>")
else
set objRootElement = objXML.documentElement
if not isObject(objRootElement) then
Response.Write("no file loaded")
else
Response.Write(objRootElement.childnodes(0).text)
end if
end if
%>
相關文章
asp中文件與文件夾常用處理函數(shù)(文件后綴、創(chuàng)建文件等)
asp中尤其是需要生產(chǎn)靜態(tài)的cms系統(tǒng)中,經(jīng)常需要對一些文件進行判斷與創(chuàng)建,刪除的操作,這里整理了一些,基本上滿足了基本需要。2011-01-01用asp實現(xiàn)網(wǎng)址和郵件地址的轉換函數(shù)
用asp實現(xiàn)網(wǎng)址和郵件地址的轉換函數(shù)...2007-11-11ASP+MSSQL2000 數(shù)據(jù)庫被批量注入后的解決方法
這陣子,采用ASP+MSSQL設計的很多網(wǎng)站可能遭遇到sql數(shù)據(jù)庫被掛馬者插入JS木馬的經(jīng)歷;這不,朋友的一個網(wǎng)站就被黑客忽悠了一把2009-02-02ASP中只有UrlEncode,沒有Urldecode問題的解決方法?
這篇文章主要介紹了ASP中只有UrlEncode,沒有Urldecode問題的解決方法? ,需要的朋友可以參考下2015-05-05