利用msxml2.xmlhttp和adodb.stream
复制代码代码如下:
<
<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
エンド機能
subsave2local(from、tofile)
Dimgeturl、Objstream、IMGS
geturl = trim(from)
imgs = gethttpimg(geturl)
setobjstream = server.createObject( "adodb.stream")
objstream.type = 1
objstream.open
objstream.writeimgs
objstream.savetofiletofile、2
objstream.close()
setobjstream =何もない
'Response.Write( "theimghassaved!")
Endingub
callave2local( "// www.vevb.com/logos.gif"、server.mappath("google.gif"))
%>
</body>
</html>