利用 msxml2.xmlHttp 和 adodb.stream
复制代码代码如下:
<!
<htmlxmlns = "http://www.w3.org/1999/xhtml">
<head>
<title> asp 采集图片测试 </title>
<metahttp-equiv = "content-type" content = "text/html; charset = utf-8"/>
</head>
<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
Função final
Subsva2local (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 = nada
'Response.Write ("Theimghassaved!")
Endsub
CallsAve2Local ("// www.vevb.com/logos.gif".server.mappath("google.gif")))
%>
</body>
</html>