利用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>