[英]Get Request Working fine with Postman but not with PHP CURL
I have simple GET request on postman and it does working fine https://www.instagram.com/p/CVhuRABqnAI/?__a=1&__d=dis我对 postman 有简单的 GET 请求,它工作正常https://www.instagram.com/p/CVhuRABqnAI/?__a=1&__d=dis
When Im using PHP CURL its did not respond me with Json data rather showing logo当我使用 PHP CURL 时,它没有用 Json 数据回应我,而是显示徽标
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0",
CURLOPT_URL => "https://www.instagram.com/p/CVhuRABqnAI/?__a=1&__d=dis",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
));
$response = curl_exec($curl);
$error = curl_error($curl);
curl_close($curl);
if($error) {
echo "cURL Error:" . $error;
} else {
echo $response;
}
Can some one else me with this?别人可以用这个吗?
Finally I might know what to do as I just faced this problem.最后我可能知道该怎么做,因为我刚刚遇到了这个问题。
Usually, there is just some kind of difference in between postman and curl.通常,postman 和 curl 之间存在某种差异。 Or there is "something" else, because my solution was just to not send any headers at all...
或者还有其他“东西”,因为我的解决方案是根本不发送任何标题......
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.