SOLVED: Help with a HTTP POST request with a binary (PDF) response
Posted: 03 Mar 2017, 19:24
I have to call an API & collect the PDF response. After looking at a few options, it looks like Blackholyman's code in this link is the easiest.
However, the response provided by the server is a binary file (PDF) which I need to download onto my computer. I'm still googling but I'm only getting other options & not really a way to work with what I have & like. Does anyone know if there's a way to interpret/download a PDF as a result of this request?
Code below was not written by me.
However, the response provided by the server is a binary file (PDF) which I need to download onto my computer. I'm still googling but I'm only getting other options & not really a way to work with what I have & like. Does anyone know if there's a way to interpret/download a PDF as a result of this request?
Code below was not written by me.
Code: Select all
WinHTTP := ComObjCreate("WinHTTP.WinHttpRequest.5.1")
;~ WinHTTP.SetProxy(0)
WinHTTP.Open("POST", "https://www.getflix.com.au/api/v1/regions.json", 0)
WinHTTP.SetCredentials("<api_key>", "x", 0)
WinHTTP.SetRequestHeader("Content-Type", "application/json")
Body := "{'service':'netflix','region':'US'}"
WinHTTP.Send(Body)
Result := WinHTTP.ResponseText
Status := WinHTTP.Status
msgbox % "status: " status "`n`nresult: " result