求教ASP图片采集
怎么用ASP把别的网站上的图片下载下来?
------解决方案-------------------- <%
function getHTTPimg(url)
on error resume next
dim http
set http=server.createobject( "MSXML2.XMLHTTP ")
Http.open "GET ",url,false
Http.send()
if Http.readystate <> 4 then exit function
getHTTPimg=Http.responseBody
set http=nothing
if err.number <> 0 then err.Clear
end function
function Save2Local(from,tofile)
dim geturl,objStream,imgs
geturl=trim(from)
imgs=gethttpimg(geturl)
Set objStream = Server.CreateObject( "ADODB.Stream ")
objStream.Type =1
objStream.Open
objstream.write imgs
objstream.SaveToFile tofile,2
objstream.Close()
set objstream=nothing
end function
%>
<%
call Save2Local(serverurl&picarray(i),picpath& "web\ "&filename& ".jpg ")
%>
摘自:http://nasdaqhe.blogchina.com/viewdiary.14736308.html