我正在尝试使用some (例如:http://api.stackoverflow.com/1.0/users/3)来获取一些数据:
<?php
$data = file_get_contents('http://api.stackoverflow.com/1.0/users/3');
echo $data;
?>但是返回的内容是乱码的。我在几个不同的服务器上测试了它,包括http://codepad.viper-7.com/9GFvsM。是我的代码还是API?
发布于 2010-10-08 00:54:05
响应是gzipped格式的。我建议您使用curl并将CURLOPT_ENCODING设置为gzip。
https://stackoverflow.com/questions/3883908
复制相似问题