Check Gzip enabled or not of a website using PHP

- 1 answer

Ad

I am creating an SEO analyzer. One part of it is to find whether a website has gzip enabled or not.

I found that gzip can be done either by .htaccess or in apache or Nginx. So how can i find whether entered website has gzip enabled or not?

Also when i open a website like this : www.example.com/.htaccess it is giving me a error saying "permission denied".

Ad

Answer

Ad

ok thank you guys. I have written the code to check gzip of a website. Here it is...

<?php
$headers = get_headers("http://www.example.com", 1);
echo $headers['Content-Encoding'];
?>
Ad
source: stackoverflow.com
Ad