Checking GZIP Compression [PHP Code]

ReqBin is the best online checking gzip compression tool. To test gzip compression for any resource, make a GET request to that resource. When gzip compression is enabled, response headers contain the Content-Encoding: gzip header and other headers. Validate returned strings with syntax highlighting and code validators. Click Send to execute the Check GZIP Compression request online and see the results. The PHP code was automatically generated for the Check Gzip Compression example.
Checking GZIP Compression [PHP Code] Send
GET /echo HTTP/1.1
Host: reqbin.com

Updated: Viewed: 17256 times
PHP code for Check Gzip Compression example

PHP code for Check Gzip Compression Example

This PHP code snippet was generated automatically for the Check Gzip Compression example.
<< Back to the Check Gzip Compression example

What is Accept-Encoding?

The Accept-Encoding HTTP Request Header is an algorithm for comparing HTTP request headers. HTTP clients tell servers what encoding they support. In response, the server will respond in whichever encoding format is supported. The server uses content negotiation to select an offer and notifies the client with a Content-Encoding response header.

GZIP Compression Format Syntax

The following is an example of gzip compression in an HTTP response:

GZIP Compression Format Syntax
Content-Encoding: gzip

GZIP Compression Example

The following is an example GET request to the ReqBin echo URL:

Client Request Example
GET /echo HTTP/1.1
Host: reqbin.com

Server response to our GET request with Content-Encoding HTTP header:

Server Response Example
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Connection: keep-alive
...
Content-Encoding: gzip

See also

Generate code snippets for PHP and other programming languages

Convert your Check Gzip Compression request to the PHP, JavaScript/AJAX, Node.js, Curl/Bash, Python, Java, C#/.NET code snippets using the PHP code generator.