婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

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

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

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

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

% 
'用ASP獲取遠程目標網(wǎng)頁指定內容,代碼由廣州網(wǎng)站建設//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獲取遠程網(wǎng)頁指定內容開始 
Dim wstr,str,url,start,over,dtime 
a="開始內容" 'ASP獲取目標網(wǎng)頁內容開始標記 
b="結束內容" 'ASP獲取網(wǎng)頁內容結束標記 
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)頁內容 
'ASP獲取遠程網(wǎng)頁指定內容結束 
%> 

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

代碼如下:

'ASP獲取遠程網(wǎng)頁指定內容開始 
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獲取遠程網(wǎng)頁的指定內容的實現(xiàn)代碼的詳細內容,更多關于獲取遠程網(wǎng)頁內容的資料請關注腳本之家其它相關文章!

標簽:唐山 滁州 來賓 甘南 迪慶 淮北 南寧 揭陽

巨人網(wǎng)絡通訊聲明:本文標題《asp獲取遠程網(wǎng)頁的指定內容的實現(xiàn)代碼》,本文關鍵詞  asp,獲取,遠程,網(wǎng)頁,的,指定,;如發(fā)現(xiàn)本文內容存在版權問題,煩請?zhí)峁┫嚓P信息告之我們,我們將及時溝通與處理。本站內容系統(tǒng)采集于網(wǎng)絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《asp獲取遠程網(wǎng)頁的指定內容的實現(xiàn)代碼》相關的同類信息!
  • 本頁收集關于asp獲取遠程網(wǎng)頁的指定內容的實現(xiàn)代碼的相關信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 淄博市| 虎林市| 微山县| 永济市| 海阳市| 林州市| 民勤县| 太保市| 怀远县| 宁河县| 闸北区| 岐山县| 柳州市| 八宿县| 宁城县| 大港区| 健康| 淅川县| 彰武县| 防城港市| 尉犁县| 玉门市| 莱芜市| 绿春县| 固阳县| 曲阜市| 星座| 嘉义县| 时尚| 麦盖提县| 鄂托克旗| 博罗县| 颍上县| 浦东新区| 弥勒县| 曲靖市| 陈巴尔虎旗| 望江县| 武隆县| 木兰县| 清徐县|