I am trying to fetch the XML feed in the compressed (gzipped) format.
Wrote the following the code. However, it still returns the feed in XML
format. It works in Java. I mean, the same service returns gzipped data
after modifying the HTTP header.
Don't know if I am doing anything wrong. Can somebody help me?
<?php
$ch = curl_init("http://abc.xyz.com/shopping.php?query=camera");
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt ($ch,CURLOPT_HEADER,0);
$headerArr = array("HTTP/1.1","Accept-Encoding: gzip;q=1.0,compress;q=0.5,identity;q=0");
curl_setopt($ch,CURLOPT_HTTPHEADER,$headerArr);
if( !($data = curl_exec ($ch)) )
echo "Cannot fetch data from the service";
else
echo $data;
curl_close ($ch);
?>
Regards,
Girish...