利用 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">
<голова>
<title> asp 采集图片测试 </title>
<metahttp-equiv = "content-type" content = "text/html; charset = utf-8"/>
</head>
<тело>
<%
Functiongethtpimg (url)
OnerRorResumenext
Dimhttp
Sethttp = server.createObject ("msxml2.xmlhttp")
Http.open "Get", url, false
Http.send ()
Ifhttp.readystate <> 4thenexitFunction
Gethttpimg = http.responsebody
Sethttp = ничего
Iferr.number <> 0thenerr.clear
Конечная функция
Subsave2local (от, тофиль)
Dimgeturl, Objstream, Imgs
Geturl = trim (от)
Imgs = gethttpimg (geturl)
SetObjStream = server.createObject ("adodb.stream")
Objstream.type = 1
Objstream.open
Objstream.writeimgs
Objstream.savetofiletofile, 2
Objstream.close ()
Setobjstream = ничего
'Response.write ("theimghassaved!")
Заканчивая
Callsave2local ("// www.vevb.com/logos.gif".server.mappath("google.gif"))))
%>
</body>
</html>