HTTPInfo()

Syntax

Result = HTTPInfo(HttpRequest, Type [, Flags])
Description
Returns information about an HTTP request created with HTTPRequest() or HTTPRequestMemory().

Parameters

HttpRequest The HTTP request to get the info.
Type The specific info to get. It can one of the following values:
  #PB_Http_StatusCode  : the server status code (200: OK, 404: page not found etc.).
  #PB_Http_Response    : the server response, as text. To get the raw server response, use HTTPMemory().
  #PB_Http_Headers     : the request headers.
  #PB_Http_ErrorMessage: the HTTP request error message, if something goes wrong (mostly for debugging purpose).
Flags (optional) The format of the HTTP response or header encoding. It can be one of the following value:
  #PB_UTF8  (default)
  #PB_Ascii

Return value

A string depending of the 'Type' parameter.

Example

  InitNetwork()
  
  HttpRequest = HTTPRequest(#PB_HTTP_Get, "https://www.google.com")
  If HttpRequest
    Debug "Response: " + HTTPInfo(HTTPRequest, #PB_HTTP_Response)
    Debug "StatusCode: " + HTTPInfo(HTTPRequest, #PB_HTTP_StatusCode)
    
    FinishHTTP(HTTPRequest)
  Else
    Debug "Request creation failed"
  EndIf

See Also

HTTPRequest(), HTTPRequestMemory()

Supported OS

All

<- GetURLPart() - Http Index - HTTPMemory() ->