<%
Имя: asp Общая функция коллекции избыточная версия, те, кто хочет изменить высококачественную версию
Автор: Лю йонфа
Дата: 2007-6-23
Functiongethttppage (path)
t = getBody (path)
gethttppage = bytestobstr (t, "gb2312")
Конечная функция
Functiongetbody (url)
OnerRorResumenext
Setxmlhttp = createObject ("microsoft.xmlhttp")
Withxmlhttp
.Open "Get", url, false "", "" "
.Отправлять
.WaitForResponse1000
Getbody =. -Responsebody
Энд
Setxmlhttp = ничего
Конечная функция
Functionbytestobstr (тело, 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 = ничего
Конечная функция
Functiongethtpimg (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
Конечная функция
Функциональные
Dimgeturl, Objstream, Imgs
geturl = trim (от)
imgs = gethttpimg (geturl)
SetObjStream = server.createObject ("adodb.stream")
objstream.type = 1
objstream.open
objstream.writeimgs
objstream.savetofiletofile, 2