Created
May 9, 2022 14:27
-
-
Save JoeGlines/aa68f8afa000a3066a498a25c319834a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;**********************Accept-Encoding********************************* | |
; https://en.wikipedia.org/wiki/HTTP_compression | |
HTTP.SetRequestHeader("Accept-Encoding","gzip, deflate") | |
HTTP.SetRequestHeader("Accept-Encoding", "gzip,deflate,sdch") ;sdch is Google Shared Dictionary Compression for HTTP | |
;***********This will write a binary file to the folder where script is running******************* | |
;***********Another great reason to use MSXML2 is that it will use your IE cookies so you don't have to deal with Authentication :)******************* | |
;***********Also read this post for pros/cons of each method: https://autohotkey.com/boards/viewtopic.php?t=9554******************* | |
URL:="http://the-Automator.com/mn/wp-content/uploads/2016/02/not_working.jpg" | |
SplitPath,URL,File_Name | |
HTTP:=ComObjCreate("MSXML2.XMLHTTP.6.0") ;https://msdn.microsoft.com/en-us/library/ms535874(v=vs.85).aspxu | |
ADODB:=ComObjCreate("ADODB.Stream") ;https://docs.microsoft.com/en-us/sql/ado/reference/ado-glossary | |
ADODB.Type:=1 ;set to 1 which is Binary 2 is text | |
HTTP.Open("GET",URL,1) ;open( Method, URL, Asynchronous, UserName, Password ) | |
HTTP.Send() | |
while(HTTP.ReadyState!=4) ;Wait for it to complete | |
Sleep,50 | |
ADODB.Open() ;After it HTTP API call completes, | |
ADODB.Write(HTTP.ResponseBody) ;Write the binary data into ADODB Stream | |
ADODB.SaveToFile(A_WorkingDir "\" File_Name,2) ;Save it to a file | |
ADODB.Close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment