利用 msxml2.xmlhttp 和 adodb.stream
复制代码代码如下:
<
<htmlxmlns = "http://www.w3.org/1999/xhtml">
<Evista>
<title> ASP 采集图片测试 </title>
<metahttp-equiv = "content-type" content = "text/html; charset = utf-8"/>
</ablo>
<Body>
<%
Functiongethttpimg (URL)
OnerrorResumEnext
Dimhttp
Sethttp = server.createObject ("msxml2.xmlhttp")
Http.open "Get", URL, falso
Http.send ()
Ifhttp.readyState <> 4thenexitFunction
Gethttpimg = http.ResponseBody
Sethttp = nada
Iferr.number <> 0thenerr.Clear
Función final
Subsave2Local (de, tofile)
Dimgeturl, objstream, imgs
GetURL = TRIM (de)
Imgs = gethttpimg (getUrl)
Setobjstream = server.createObject ("ADODB.Stream")
Objstream.type = 1
Objstream.
Objstream.writeimgs
Objstream.savetofiletofile, 2
Objstream.close ()
Setobjstream = nada
'Response.write ("¡THEIMGHAssaved!")
Endsub
LISTSAVE2LOCAL ("// www.vevb.com/logos.gif" ,server.mappath("google.gif"))
%>
</body>
</html>