Search code examples
phpguzzlecontent-lengthgoutte

Goutte / GuzzleHTTP Get the Content-Length / Size of the response body


I am using https://github.com/FriendsOfPHP/Goutte to scrape a page. No probs there.

I am trying to get the Content-Length from the client response object, but cannot see how I can do this.


Solution

  • Clicking through the docs... Use $response = $client->getInternalResponse() to get a Symfony\Component\BrowserKit\Response which as a $response->getHeader('Content-Length') available. :-)