原创的一段通过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 ("http://stock.jrj.com.cn/htmdata/gifindex/Sh_000001.png","sh1.png")%>
<img src="Sh1.png">
<%=img ("http://stock.jrj.com.cn/htmdata/gifindex/sz_399001.png","sh2.png")%>
<img src="Sh2.png">
<%=img ("http://business.sohu.com/new_world_index.html","gjgshq.html")%>
<iframe name="a" scrolling="auto" frameborder="0" src="gjgshq.html" width="160" height="140"></iframe>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值