<%
'名前:ASP一般的なコレクション機能冗長バージョン、高品質のバージョン自体を変更したい人
著者:Liu Yongfa
'日付:2007-6-23
functiongethttppage(パス)
t = getBody(パス)
gethttppage = bytestobstr(t、 "gb2312")
エンド機能
functiongetbody(url)
onerrorresumenext
setXmlhttp = createObject( "microsoft.xmlhttp")
withxmlhttp
.Open "Get"、url、false ""、 "
。送信
.waitforresponse1000
GetBody = .ResponseBody
終わりに
setxmlhttp =何もない
エンド機能
functionbytestobstr(body、cset)
onerrorresumenext
DimobjStream
setobjstream = server.createObject( "adodb.stream")
objstream.type = 1
objstream.mode = 3
objstream.open
objstream.writebody
objstream.position = 0
objstream.type = 2
objstream.charset = cset
bytestobstr = objstream.readtext
objstream.close
setobjstream =何もない
エンド機能
functiongethttpimg(url)
onerrorresumenext
dimxmlhttp
setxmlhttp = server.createObject( "msxml2.xmlhttp")
xmlhttp.open "get"、url、false
xmlhttp.send()
ifxmlhttp.status <> 200thenexitfunction
gethttpimg = xmlhttp.responsebody
setxmlhttp =何もない
iferr.number <> 0thenerr.clear
エンド機能
functionsave2local(from、tofile)
Dimgeturl、Objstream、IMGS
geturl = trim(from)
imgs = gethttpimg(geturl)
setobjstream = server.createObject( "adodb.stream")
objstream.type = 1
objstream.open
objstream.writeimgs
objstream.savetofiletofile、2