Here is the relevant section of code from stack.PHPstack.PHP.
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_ENCODING,'gzip'); // Needed by API
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$data = curl_exec($ch);