http://www.gidnetwork.com/tools/gzip-test.php is a great tool, but I need to test a site behind some walls and want to find similar results: compression type, markup size, compressed page size, and compression ratio.
How can I get both compressed and uncompressed page sizes? What is a better method for fetching this data (file_get_contents()
or curl
)?
The response headers contain everything else needed - I'm just not sure about the sizes.
You have to use the CURL as there are two reasons to do so:
As you need the Headers of the request and you can have through CURL easily
file_get_contents()
generally used internally to include things and not for external source to fetch data. If you used it for external purposes then there are some issue like memory limit, size etc. have to be taken great care of.
$headerArray = get_headers($pointer);
$fileSize = $headerArray['Content-Length'];