Page 1 of 1

Http Request questions

Posted: Sat Nov 09, 2019 1:10 pm
by ynkrc
like this:

Code: Select all

InitNetwork()

NewMap Header$()
  Header$("Content-Type") = "plaintext"
  Header$("UserAgent") = "Firefox 54.0"
  httpheader$=GetHTTPHeader("https://www.google.com",#PB_HTTP_NoRedirect,Header$("UserAgent"))
  HttpRequest = HTTPRequest(#PB_HTTP_Get, "https://www.google.com", "", 0, Header$())
  If HttpRequest
    Debug "StatusCode: " + HTTPInfo(HTTPRequest, #PB_HTTP_StatusCode)
    Debug "Response: " + HTTPInfo(HTTPRequest, #PB_HTTP_Response)
    
    FinishHTTP(HTTPRequest)
  Else
    Debug "Request creation failed"
  EndIf
GetHTTPHeaderand HTTPRequest seem to be two query operations,the infomation got can't match each other.
but how can I get the real ResponseHeader of the HTTPRequest ,like the libCurl setting below?

Code: Select all

curl_setopt($ch, CURLOPT_HEADER, 1);

Re: Http Request questions

Posted: Sat Nov 09, 2019 1:26 pm
by infratec
This is not possible at the moment.
Fred has not implemented this up to now. But it is on the feature request list.

So you have to use libcurl.pbi