<%
'Nome: ASP Geral Collection Função Redundant Versão, aqueles que desejam modificar a própria versão de alta qualidade
'Autor: Liu Yongfa
Data: 2007-6-23
Functiongethttppage (caminho)
t = getBody (caminho)
gethttppage = bytestobstr (t, "gb2312")
Função final
FunctionGetBody (URL)
OnErrorReSumenext
SetxmlHttp = CreateObject ("Microsoft.xmlHttp")
WithXmlHttp
.Popen "Get", URL, False, "", ""
.Enviar
.WaitForreSponse1000
GetBody = .ResponseBody
ENDWITH
SetxmlHttp = nada
Função final
FunctionByTestobstr (corpo, 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 = nada
Função final
Functiongethttpimg (url)
OnErrorReSumenext
DimxmlHttp
SetxmlHttp = server.createObject ("msxml2.xmlHttp")
xmlhttp.open "get", url, false
xmlhttp.send ()
IfxmlHttp.status <> 200ThenexitFunction
gethttpimg = xmlHttp.ResponseBody
SetxmlHttp = nada
Iferr.number <> 0TheNerr.clear
Função final
Funções
Dimgeturl, objstream, imgs
geturl = Trim (de)
imgs = gethttpimg (geturl)
Setobjstream = server.createObject ("adodb.stream")
objstream.type = 1
objstream.open
objstream.writeimgs
objstream.savetofiletofile, 2