利用msxml2.xmlhttp和adodb.stream
复制代码代码如下:
<!doctypehtmlpublic“ - // w3c // dtdxhtml1.0transitional // en”“” http://www.org/tr/xhtml1/xhtml1/dtd/xhtml1/xhtml1-transitional.dtd'>
<htmlxmlns =“ http://www.w3.org/1999/xhtml”>
<头>
<title> ASP </title>
<metahttp-equiv =“ content-type” content =“ text/html; charset = utf-8”/>
</head>
<身体>
<%
功能GETHTPIMG(URL)
Onorresumenext
dimhttp
sethttp = server.createobject(“ msxml2.xmlhttp”)
http.open“ get”,url,false
http.send()
ifhttp.readystate <> 4thenexitFunction
gethtpimg = http.Responsebody
sethttp =没有
iferr.number <> 0thenerr.clear
最终功能
subave2local(来自,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 =没有
'wrespy.write(“ theimghassaved!”)
endub
callave2local(“ // www.vevb.com/logos.gif",server.mappath(" google.gif”))
%>
</body>
</html>