|
您的位置: 首頁 > 網(wǎng)站資訊 > 獲取遠(yuǎn)程網(wǎng)頁內(nèi)容實(shí)例代碼 |
獲取遠(yuǎn)程網(wǎng)頁內(nèi)容實(shí)例代碼發(fā)布日期:2017/7/13
Function getHTTPPage(url) 'Asp 獲取遠(yuǎn)程網(wǎng)頁內(nèi)容實(shí)例代碼 dim http set http=Server.createobject("Microsoft.XMLHTTP")'建立XMLHTTP對(duì)象 Http.open "GET",url,false '設(shè)置http對(duì)象打開體例 GET體例,URL[連接頁面地址],同步處理 Http.send() '發(fā)送請(qǐng)求 if Http.readystate<>4 then'對(duì)象處理狀況為 非結(jié)束 exit function '退出函數(shù) end if getHTTPPage=bytesToBSTR(Http.responseBody,"gb2312")'BytesToBstr獲取的源碼轉(zhuǎn)換為中文的代碼 set http=nothing '消滅對(duì)象 if err.number<>0 then err.Clear '消滅錯(cuò)誤 End function '================================================== |
其他相關(guān)文章 |
|
|
|
||||||||
Copyright 2012-2025 上海蒙狼網(wǎng)絡(luò)科技有限公司 www.jnjiaoyu.cn All Rights Reserved |