Here is the relevant section of code from [stack.PHP](https://stackapps.com/questions/826/stack-php-clean-easy-to-use-wrapper-for-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);