DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> XML學習教程 >> XML詳解 >> 一段通過XML來遠程抓娶圖片的代碼
一段通過XML來遠程抓娶圖片的代碼
編輯: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="/School/UploadFiles_7810/201104/20110414065730896.png">
<%=img ("http://stock.jrj.com.cn/htmdata/gifindex/sz_399001.png","sh2.png")%>
<img src="/School/UploadFiles_7810/201104/20110414065730269.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>

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved