A piece of code that uses XML to capture pictures remotely

Source: Internet
Author: User
Xml

<%
' Function 1 call xsmxl2.xmlhttp for remote crawl
function gethttppage (URL)
On Error Resume Next
Dim http
Set Http=server.createobject ("Msxml2.xmlhttp") ' uses XMLHTTP method to get the contents of a picture
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
' function 2 to save data
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 "," Http://www.webjx.com/htmldata/2005-08-22/Sh1.png " )%>

<%=img ("http://stock.jrj.com.cn/htmdata/gifindex/sz_399001.png "," Http://www.webjx.com/htmldata/2005-08-22/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>



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.