濮阳杆衣贸易有限公司

主頁 > 知識庫 > asp獲取遠(yuǎn)程網(wǎng)頁的指定內(nèi)容的實(shí)現(xiàn)代碼

asp獲取遠(yuǎn)程網(wǎng)頁的指定內(nèi)容的實(shí)現(xiàn)代碼

熱門標(biāo)簽:石家莊慧營銷外呼系統(tǒng) 濟(jì)源電銷外呼系統(tǒng)線路 世界地圖標(biāo)注了哪些城市 外呼線路批發(fā) 武穴地圖標(biāo)注 梧州市地圖標(biāo)注 java外呼系統(tǒng)是什么 地圖標(biāo)注陽江 創(chuàng)意電話機(jī)器人

核心函數(shù)代碼如下:

% 
'用ASP獲取遠(yuǎn)程目標(biāo)網(wǎng)頁指定內(nèi)容,代碼由廣州網(wǎng)站建設(shè)//www.jb51.net提供 
On Error Resume Next 
Server.ScriptTimeOut=9999999 
Function getHTTPPage(Path) 
t = GetBody(Path) 
getHTTPPage=BytesToBstr(t,"GB2312") 
End function 
Function Newstring(wstr,strng) 
Newstring=Instr(lcase(wstr),lcase(strng)) 
if Newstring=0 then Newstring=Len(wstr) 
End Function 
Function BytesToBstr(body,Cset) 
dim objstream 
set objstream = Server.CreateObject("adodb.stream") 
objstream.Type = 1 
objstream.Mode =3 
objstream.Open 
objstream.Write body 
objstream.Position = 0 
objstream.Type = 2 
objstream.Charset = Cset 
BytesToBstr = objstream.ReadText 
objstream.Close 
set objstream = nothing 
End Function 
Function GetBody(url) 
on error resume next 
Set Retrieval = CreateObject("Microsoft.XMLHTTP") 
With Retrieval 
.Open "Get", url, False, "", "" 
.Send 
GetBody = .ResponseBody 
End With 
Set Retrieval = Nothing 
End Function 

'ASP獲取遠(yuǎn)程網(wǎng)頁指定內(nèi)容開始 
Dim wstr,str,url,start,over,dtime 
a="開始內(nèi)容" 'ASP獲取目標(biāo)網(wǎng)頁內(nèi)容開始標(biāo)記 
b="結(jié)束內(nèi)容" 'ASP獲取網(wǎng)頁內(nèi)容結(jié)束標(biāo)記 
url="http://sc.jb51.net/" 
wstr=getHTTPPage(url) 
start=Newstring(wstr,a) 
over=Newstring(wstr,b) 
body=mid(wstr,start,over-start) 
response.write ""body"" '輸出獲取到的網(wǎng)頁內(nèi)容 
'ASP獲取遠(yuǎn)程網(wǎng)頁指定內(nèi)容結(jié)束 
%> 

上面的代碼可以獲取指定網(wǎng)頁的內(nèi)容,如果是全部獲取就更簡單了

代碼如下:

'ASP獲取遠(yuǎn)程網(wǎng)頁指定內(nèi)容開始 
Dim wstr,str,url,start,over,dtime 
url="http://sc.jb51.net/" 
wstr=getHTTPPage(url) 
body=wstr

如果想將代碼保存到本地

Dim wstr,str,url,start,over,dtime
url="https://www.jb51.net/"
wstr=getHTTPPage(url)
filename="index.htm"
if wstr>"" and request("action")="makeindex" then
body=wstr
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.CreateTextFile(server.mappath(""filename""))
fout.Write body
fout.close
set fout=nothing
set fso=nothing
If Err.number=0 then
response.write("div class=""tishi"">首頁生成成功??!/div>")
end if
end if

具體的大家可以根據(jù)需要自行修改即可。

以上就是asp獲取遠(yuǎn)程網(wǎng)頁的指定內(nèi)容的實(shí)現(xiàn)代碼的詳細(xì)內(nèi)容,更多關(guān)于獲取遠(yuǎn)程網(wǎng)頁內(nèi)容的資料請關(guān)注腳本之家其它相關(guān)文章!

標(biāo)簽:唐山 滁州 來賓 甘南 迪慶 淮北 南寧 揭陽

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《asp獲取遠(yuǎn)程網(wǎng)頁的指定內(nèi)容的實(shí)現(xiàn)代碼》,本文關(guān)鍵詞  asp,獲取,遠(yuǎn)程,網(wǎng)頁,的,指定,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《asp獲取遠(yuǎn)程網(wǎng)頁的指定內(nèi)容的實(shí)現(xiàn)代碼》相關(guān)的同類信息!
  • 本頁收集關(guān)于asp獲取遠(yuǎn)程網(wǎng)頁的指定內(nèi)容的實(shí)現(xiàn)代碼的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    龙江县| 射阳县| 达州市| 水城县| 依安县| 上栗县| 赤水市| 石景山区| 新余市| 柯坪县| 高平市| 凤阳县| 大兴区| 潍坊市| 岳阳县| 富源县| 萍乡市| 鄯善县| 永寿县| 巴中市| 北票市| 余江县| 文昌市| 濮阳市| 华容县| 尼勒克县| 神农架林区| 武清区| 安图县| 台安县| 乌兰浩特市| 黔南| 泰和县| 德格县| 静海县| 北碚区| 平南县| 奉贤区| 武汉市| 舒城县| 吕梁市|