利用 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">
<head>
<title> asp 采集图片测试 </iteme>
<metahttp-equiv = "konten-tipe" content = "text/html; charset = utf-8"/>
</head>
<body>
<%
FunctionGetHttpimg (url)
OnerrorresumeNext
DIMHTTP
SetHttp = server.CreateObject ("msxml2.xmlhttp")
Http.open "get", url, false
Http.send ()
Ifhttp.readystate <> 4thenexitfunction
GetHttpimg = http.responseBody
SetHttp = tidak ada
Iferr.number <> 0thenerr.clear
Fungsi endfungsi
Subsave2local (dari, tofile)
DimgetUrl, objstream, imgs
GetUrl = trim (dari)
Imgs = getHttpimg (getUrl)
SetoBjStream = server.CreateObject ("adodb.stream")
Objstream.type = 1
Objstream.open
Objstream.writeimgs
Objstream.savetofiletofile, 2
Objstream.close ()
Setobjstream = tidak ada
'Response.write ("Theimghassaved!")
Endsub
CallAve2local ("// www.vevb.com/logos.gif".server.mappath("google.gif"))
%>
</body>
</html>