cURL returning garbage data
curl, php
Solution
The headers show it:
TTP/1.1 200 OK
Date: Thu, 14 Jun 2012 14:25:49 GMT
Server: Apache
Vary: Accept-Encoding,Cookie
Cache-Control: max-age=3, must-revalidate
WP-Super-Cache: Served supercache file from PHP
Content-Encoding: gzip
Content-Length: 16502
Connection: close
Content-Type: text/html; charset=UTF-8
So you see `gzip`'ed data, which is not human-readable.
Edit
As from comment below: To overcome this, use a header of `Accept-Encoding: identity`, which you can get by
curl_setopt($curlObj, CURLOPT_ENCODING, 'identity');
Problem
I am using the following code, which is working fine for other urls, however, for the url "http://lisakifttherapy.com/", I am getting it wrong, showing a lot of gerbage data. Anybody any idea why this is happening and how to overcome this please? Thanks in advance. ``` $curlObj = curl_init(); curl_setopt($curlObj, CURLOPT_URL, "http://lisakifttherapy.com/"); curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, true); curl_setopt($curlObj, CURLOPT_FOLLOWLOCATION, true); $content = curl_exec($curlObj); echo $content; ```