国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

兩種小偷程序的比較

2024-05-04 11:07:54
字體:
來源:轉載
供稿:網友
Function GetURL(url) 
Set Retrieval = CreateObject("Microsoft.XMLHTTP") 
With Retrieval 
.Open "GET", url, False
.Send 
GetURL = bytes2bstr(.responsebody)
'對取得信息進行驗證,如果信息長度小于100則說明截取失敗
if len(.responsebody)<100 then
response.write "獲取遠程文件 <a href="&url&" target=_blank>"&url&"</a> 失敗。"
response.end
end if
End With 
Set Retrieval = Nothing 
End Function
' 二進制轉字符串,否則會出現亂碼的!
function bytes2bstr(vin) 
strreturn = "" 
for i = 1 to lenb(vin) 
thischarcode = ascb(midb(vin,i,1)) 
if thischarcode < &h80 then 
strreturn = strreturn & chr(thischarcode) 
else 
nextcharcode = ascb(midb(vin,i+1,1)) 
strreturn = strreturn & chr(clng(thischarcode) * &h100 + cint(nextcharcode)) 
i = i + 1 
end if 
next 
bytes2bstr = strreturn 
end function 
function savetofile(bodyall,filename)
dim objstream1
set objstream1=createobject("adodb.stream")
objstream1.type=2
objstream1.open
objstream1.position=objstream1.size
objstream1.writetext bodyall
objstream1.savetofile filename,2
objstream1.close
set objstream1=nothing
end function
'聲明截取的格式,從Start開始截取,到Last為結束
Function GetKey(HTML,Start,Last)
filearray=split(HTML,Start)
filearray2=split(filearray(1),Last)
GetKey=filearray2(0)
End Function
url="http://www.86516.com"
Html = GetURL(Url)
savetofile html,"ce.htm"

第二種:
</P>
<P>
function gethttppage(url)
dim http
set http=createobject("MICROSOFT.XMLHTTP")
http.open "GET",url,false
http.send()
if http.readystate<>4 then
exit function
end if
gethttppage=bytestostr(http.responseBody,"GB2312")
if err.number<>0 then err.clear
end function</P>
<P>function bytestostr(body,cset)
dim objstream
set objstream=createobject("adodb.stream")
objstream.type=1
objstream.mode=3
objstream.open
objstream.write body
objstream.position=0
objstream.type=2
objstream.charset=cset
bytestostr=objstream.readtext
objstream.close
set objstream=nothing
end function</P>
<P>function savetofile(bodyall,filename)
dim objstream1
set objstream1=createobject("adodb.stream")
objstream1.type=2
objstream1.open
objstream1.position=objstream1.size
objstream1.writetext bodyall
objstream1.savetofile filename,2
objstream1.close
set objstream1=nothing
end function</P>
<P>dim url,http
url="http://www.86516.com"
html=gethttppage(url)
'msgbox html
savefilename="index1.htm"
savetofile html,savefilename</P>
<P>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 盈江县| 克东县| 莆田市| 栾城县| 义乌市| 昌乐县| 临西县| 庆安县| 霍州市| 昆明市| 观塘区| 乐清市| 通化市| 吉林省| 伊春市| 黄浦区| 张家口市| 庆安县| 鄂托克前旗| 江源县| 南城县| 麻栗坡县| 拉萨市| 天峨县| 凤城市| 荔波县| 西青区| 四平市| 灵璧县| 西贡区| 行唐县| 鄯善县| 镇远县| 广德县| 襄垣县| 桂东县| 延长县| 浑源县| 景德镇市| 简阳市| 静乐县|