利用 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 采集图片测试 </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, false
http.send ()
ifhttp.readystate <> 4thenexitfunction
gethttpimg = http.responsebody
sethttp = ไม่มีอะไร
iferr.number <> 0thenerr.Clear
endfunction
subsave2local (จาก, tofile)
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!")
enddub
callesave2local ("// www.vevb.com/logos.gif", server.mappath("google.gif")))))))))))))))))))
-
</body>
</html>