Php 什么';我的卷曲代码怎么了?堆栈溢出';s API给了我可疑的字符链
尝试添加Php 什么';我的卷曲代码怎么了?堆栈溢出';s API给了我可疑的字符链,php,api,curl,Php,Api,Curl,尝试添加 <?php function get($get){ $ch = curl_init("http://api.$get.com/1.1/users/?filter=genesis&max=10000&min=5000"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); echo $output = curl_exec($ch); } get("stackover
<?php
function get($get){
$ch = curl_init("http://api.$get.com/1.1/users/?filter=genesis&max=10000&min=5000");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo $output = curl_exec($ch);
}
get("stackoverflow");
到您的代码。API的响应是gzip编码的只使用文件内容($url)怎么样@yes123:同样,您是否查看了SO API响应中的标题?像
ContentEncoding:gzip
之类的东西?
<?php
function get($get){
$ch = curl_init("http://api.$get.com/1.1/users/?filter=genesis&max=10000&min=5000");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo $output = curl_exec($ch);
}
get("stackoverflow");
curl_setopt($ch,CURLOPT_ENCODING , "gzip");