利用 msxml2.xmlhttp 和 adodb.stream
复制代码代码如下:
<! Doctypehtmlpublic "- // w3c // dtdxhtml1.0transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<htmlxmlns = "http://www.w3.org/1999/xhtml">
<adal>
<Title> ASP 采集图片测试 </TITME>
<Metahttp-Equiv = "Content-Type" Content = "Text / Html; charSet = UTF-8" />
</ head>
<body>
<%
FonctionGethttpimg (URL)
Onerrorresumenext
Dimhttp
Sethttp = server.createObject ("msxml2.xmlhttp")
Http.open "get", URL, faux
Http.send ()
Ifhttp.readystate <> 4ThenexitFunction
Gethttpimg = http.Responsebody
Sethttp = rien
Iferr.number <> 0TheRerr.Clear
Finition de fin
Subsave2local (de, tofile)
Dimgeturl, objstream, imgs
GetUrl = trim (de)
Imgs = gethttpimg (geturl)
SetObjstream = server.createObject ("adodb.stream")
Objstream.type = 1
Objstream.open
Objstream.writeImgs
Objstream.savetofiletofile, 2
Objstream.close ()
SetObjstream = rien
'Response.Write ("TheImGhassaved!")
Fin
CALLAGE2LOCAL ("// www.vevb.com/logos.gif",server.mappath("google.gif"))
%>
</docy>
</html>