php - file_get_contents() returns garbled data -
i trying use api (eg: http://api.stackoverflow.com/1.0/users/3) data:
<?php $data = file_get_contents('http://api.stackoverflow.com/1.0/users/3'); echo $data; ?>
but returned contents garbled. tested on couple different servers, including http://codepad.viper-7.com/9gfvsm. code or api?
the response gzipped. recommend use curl , set curlopt_encoding
gzip.
Comments
Post a Comment