Advertisement
Advertisement
| 04.15.2008 at 09:38PM PDT, ID: 23325996 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: |
Sub ExtractFile(url,folder)
TEMPPATH = folder & "\"
Rem Parses the filename from the url
outputfile = TEMPPATH & Mid(url, InStrRev(url, "/") + 1)
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set fsoMain = CreateObject("Scripting.FileSystemObject")
Set objHTTP = CreateObject("Microsoft.XMLHTTP")
Set fsResults = fsoMain.OpenTextFile(outputfile, ForWriting, True)
Call objHTTP.Open("GET", url, False)
objHTTP.Send
Dim i
REM Write the file byte by byte
For i = 1 To LenB(objHTTP.ResponseBody)
fsResults.Write Chr(AscB(MidB(objHTTP.ResponseBody, i, 1)))
Next
Set fsoMain=Nothing
Set objHTTP=Nothing
Set fsResults=Nothing
End Sub
|