一段通过XML来远程抓娶图片的代码

80酷酷网    80kuku.com

  xml

<%
'函数1调用XSMXL2.XMLHTTP来进行远程抓取
function getHTTPPage(url)
on error resume next
dim http
set http=server.createobject("MSXML2.XMLHTTP")'使用xmlhttp的方法来获得图片的内容
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=Http.responseBody
set http=nothing
if err.number<>0 then err.Clear
end function
'函数2 对数据进行保存
function img(from,tofile)
dim geturl,objStream,imgs
geturl=trim(from)
imgs=gethttppage(geturl)
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type =1
objStream.Open
objstream.write imgs
objstream.SaveToFile server.mappath(tofile),2
objstream.Close()
set objstream=nothing
end function
%>
<%=img (">
<img src="http://www.webjx.com/htmldata/2005-08-22/Sh1.png">
<%=img (">
<img src="http://www.webjx.com/htmldata/2005-08-22/Sh2.png">
<%=img (">
<iframe name="a" scrolling="auto" frameborder="0" src="gjgshq.html" width="160" height="140"></iframe>



分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: