Created
May 30, 2021 17:26
-
-
Save JoeGlines/349a3458b0ae307b4a5342a09555e23d 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
#SingleInstance,Force | |
IniRead, API_Key ,Auth.ini,API, Key ;Get your own key and put it into the API_Key variable | |
;************************************** | |
Term:="Pretty cool i think" | |
Endpoint:="https://capitalize-my-title.p.rapidapi.com/title/" | |
HTTP:=ComObjCreate("WinHttp.WinHttpRequest.5.1") ;Create COM Object | |
HTTP.Open("GET",Endpoint Term) ;Open the Connection | |
HTTP.SetRequestHeader("X-Rapidapi-Host","capitalize-my-title.p.rapidapi.com") | |
HTTP.SetRequestHeader("X-Rapidapi-Key",API_Key) | |
;~ HTTP.SetProxy(2,"localhost:8888") ;Use if Fiddler is running | |
HTTP.Send() | |
;~ clipboard:=HTTP.ResponseText ;Causes weird error | |
Msgbox % text:=ConvertResponseBody(HTTP) | |
ConvertResponseBody(oHTTP){ | |
bytes:=oHTTP.Responsebody ;Responsebody has an array of bytes. Single characters. | |
loop, % oHTTP.GetResponseHeader("Content-Length") ;loop over responsbody 1 byte at a time | |
text .= chr( bytes[A_Index-1] ) ;lookup each byte and assign a charter | |
return text | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment