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().

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

  InitNetwork()
  
  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() ->