佳木斯湛栽影视文化发展公司

主頁(yè) > 知識(shí)庫(kù) > asp下利用XMLHTTP 從其他頁(yè)面獲取數(shù)據(jù)的代碼

asp下利用XMLHTTP 從其他頁(yè)面獲取數(shù)據(jù)的代碼

熱門標(biāo)簽:Mysql連接數(shù)設(shè)置 電子圍欄 Linux服務(wù)器 阿里云 服務(wù)器配置 銀行業(yè)務(wù) 團(tuán)購(gòu)網(wǎng)站 科大訊飛語(yǔ)音識(shí)別系統(tǒng)
利用XMLHTTP 從其他頁(yè)面獲取數(shù)據(jù)

我們?cè)诰帉慉SP代碼的時(shí)候,大家都知道可以通過post或者get獲得form表單的數(shù)據(jù),那么我們?nèi)绾沃苯荧@得其他頁(yè)面上的數(shù)據(jù)呢?這就要借助xmlhttp協(xié)議了。xmlhttp是xmldom技術(shù)的一部分。

下面的代碼就是一個(gè)很簡(jiǎn)單的例子,我們利用xmlhttp技術(shù),把http://www.xxxx.com/站點(diǎn)首頁(yè)的代碼以xml的形式完全獲取,并且在頁(yè)面中輸出。

%
Dim objXMLHTTP, xml
Set xml = Server.CreateObject("Microsoft.XMLHTTP")

xml.Open "GET", "http://www.codetoad.com/", False
' Pull the data from the web page
xml.Send

Response.write "Here's the html we now have in our xml object"
Response.write "BR>BR>BR>"
Response.Write "xmp>"
Response.Write xml.responseText
Response.Write "/xmp>"
Response.write "BR>BR>BR>"
Response.write " Now here's how the page looks:BR>BR>"
Response.Write xml.responseText

Set xml = Nothing
%>


下面是另一個(gè)實(shí)例

%
dim objHTTP , objXML , objXSL
set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")
objHTTP.open "GET", "http://p.moreover.com/cgi-local/page?c=Pop%20music%20reviewso=xml", false
objHTTP.send
set objXML = objHTTP.responseXML
set objXSL=Server.CreateObject("microsoft.xmldom")
objXSL.async=false

objXSL.load(Server.MapPath("style.xsl"))

if (objXSL.parseError.errorCode = 0) then
Response.Write(objXML.transformnode(objXSL))
else
Response.Write "Error: "  objXSL.parseError.reason  " URL:"  objXSL.url
end if

Set objHTTP = Nothing
Set objXML = Nothing
Set objXSL = Nothing
%>

style.xsl:
xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
xsl:template match="/">

html>
head>
TITLE>moreover.../TITLE>
/head>
body BGCOLOR="ffffff">



DIV ALIGN="center">
TABLE BGCOLOR="ffffff" BORDER="0" CELLPADDING="4" CELLSPACING="0" WIDTH="100%">

xsl:for-each select="moreovernews/article">

TR VALIGN="middle">
TD ALIGN="left" BGCOLOR="ffffff">


xsl:attribute name="HREF">
xsl:value-of select="url"/>
/xsl:attribute>
xsl:attribute name="TARGET">
_blank
/xsl:attribute>

xsl:value-of select="headline_text"/>





xsl:attribute name="HREF">
xsl:value-of select="document_url"/>
/xsl:attribute>
xsl:attribute name="TARGET">
_blank
/xsl:attribute>

xsl:value-of select="source"/>



xsl:attribute name="HREF">
xsl:value-of select="access_registration"/>
/xsl:attribute>
xsl:attribute name="TARGET">
_blank
/xsl:attribute>

xsl:value-of select="access_status"/>



xsl:value-of select="harvest_time"/> GMT

/TD>
/TR>

/xsl:for-each>


/TABLE>
/DIV>
/body>
/html>
/xsl:template>
/xsl:stylesheet>

標(biāo)簽:衢州 衡水 萍鄉(xiāng) 蚌埠 江蘇 廣元 大理 棗莊

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《asp下利用XMLHTTP 從其他頁(yè)面獲取數(shù)據(jù)的代碼》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    潞西市| 巴青县| 上栗县| 若尔盖县| 阿拉尔市| 叶城县| 双柏县| 儋州市| 东城区| 镇坪县| 霞浦县| 凤山县| 阿拉善右旗| 平谷区| 信宜市| 长白| 宝应县| 桑植县| 金秀| 灵寿县| 泰顺县| 虞城县| 纳雍县| 碌曲县| 马龙县| 晴隆县| 贵定县| 叙永县| 阳春市| 钟祥市| 靖江市| 新余市| 获嘉县| 平度市| 海兴县| 霍山县| 安平县| 黎城县| 厦门市| 得荣县| 荥经县|