HTTPMemory()

Syntax

*Buffer = HTTPMemory(HttpRequest)
Description
Returns a memory buffer containing the whole response of an HTTP request created with HTTPRequest() or HTTPRequestMemory(). Once done with it, the buffer needs to be freed with FreeMemory(). If the flag #PB_HTTP_Asynchronous was used when calling HTTPRequest() or HTTPRequestMemory(), this command is only valid if the request has been successful.

Parameters

HttpRequest The HTTP request to get the raw response.

Return value

A memory buffer containing the whole response of an HTTP request. Once done with it, the buffer needs to be freed with FreeMemory().

Example

  HttpRequest = HTTPRequest(#PB_HTTP_Get, "https://www.google.com")
  If HttpRequest
    Debug "Response: " + HTTPInfo(HTTPRequest, #PB_HTTP_Response)
    
    *Response = HTTPMemory(HTTPRequest)
    
    FinishHTTP(HTTPRequest)
    
    Debug "Response size: " + MemorySize(*Response)
    FreeMemory(*Response)
    
  Else
    Debug "Request creation failed"
  EndIf

See Also

HTTPRequest(), HTTPRequestMemory()

Supported OS

All

<- HTTPInfo() - Http Index - HTTPProgress() ->