Search code examples
phpgzipdeflate

checking if a web page has compression enabled with php


I want to check if a web page has gzip/deflate compression enabled with php. Probably with get_headers I won`t make it, so a anydvices, or any bit of code anywhere to check this ( couldn't find anything on the subject ). Probably I need to find in the headers for the compression, how do i make a HTTP request with compression enabled ?


Solution

  • You can use curl and use curl_setopt,
    set CURLOPT_ENCODING to gzip,deflate

    if the webpage is gzip/deflate enabled,
    the encoding request will be respect and gzip content will be returned