Remember a lot of editors, automatic collection system is a function of automatically save remote pictures, probably the principle is to use the XMLHTTP object to get pictures, and then write to save with the stream object, referring to the online code, wrote a, and circulated code no difference! The code is as follows, one function:
<%
Function saveremotefile (ssavepath,sremotefileurl) on
Error Resume Next
saveremotefile = False
Dim Oxml:set oxml = Server.CreateObject ("Microsoft.XMLHTTP") with
oXML
. Open "Get", Sremotefileurl,false, "", ""
. Send
If. status<>200 Then Exit Function
remotedate =. Responsebody End and
Set oxml = Nothing
Dim ostream:set ostream = Server.CreateObject ("Adodb.strea M ") with
ostream
. Type = 1
. Open
. Write remotedate
. SaveToFile ssavepath,2
If err.number=0 Then saveremotefile = True
. Close () End with
Set ostream = Nothing End
Function
' Invoke method as follows
Saveaddr=server.mappath ("Demo.gif")
sourceurl= "Http://www.google.cn/intl/zh-CN/images/logo_cn.gif"
Call Saveremotefile (saveaddr,sourceurl)
%>
Tag