利用 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 采集图片测试 </itlem>
<metahttp-equiv = "content-type" content = "text/html ؛ charset = utf-8"/>
</head>
<body>
<٪
FunctionGethttpimg (URL)
onerrorresumenext
DIMHTTP
sethttp = server.createBject ("msxml2.xmlhttp")
http.Open "get" ، url ، false
http.send ()
ifhttp.readyState <> 4thenexitfunction
gethttpimg = http.responseBody
sethttp = لا شيء
iferr.number <> 0thenerr.clear
الوظيفية
subave2local (من ، tofile)
Dimgeturl ، objstream ، imgs
geturl = trim (من)
IMGS = gethttpimg (geturl)
setObjStream = server.createBject ("Adodb.stream")
objstream.type = 1
objstream.Open
objstream.writeimgs
objstream.savetofiletofile ، 2
objstream.close ()
setObjStream = لا شيء
'الرد. write ("theimghassaved!")
ينتهي
callsave2local ("// www.vevb.com/logos.gif"،server.mappath("Google.gif"))))
٪>
</body>
</html>