利用 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">
<kopf>
<title> ASP 采集图片测试 </title>
<metahttp-äquiv = "content-type" content = "text/html; charset = utf-8"/>
</head>
<body>
<%
FunctionNeethttpimg (URL)
OnErrorresumeNext
Dimhttp
Sethttp = server.createObject ("msxml2.xmlhttp"))
Http.open "get", url, falsch
Http.send ()
IFHTTP.REYYSTATE <> 4Thenexitfunction
Gethttpimg = http.responsebody
Sethttp = nichts
Ifer.number <> 0Thenerr.clear
Endfunktion
Subve2Local (from, toFile)
Dimgeturl, Objstream, IMGS
Geturl = trimm (von)
IMGS = Gethttpimg (Geturl)
SetObjstream = server.createObject ("adodb.stream")
Objstream.type = 1
Objstream.open
Objstream.WriteImgs
Objstream.Savetofiletofile, 2
Objstream.close ()
SetObjstream = nichts
'Response.write ("theimghassaved!")
Ende
Callave2Local ("// www.vevb.com/logos.gif",server.mappath("google.gif")))
%>
</body>
</html>