Php 如何从instagram.com/user/?\uu a=1获取json
我正在使用curl with postman通过此URL从Instagram用户处获取json“https://www.instagram.com/kiddothegame/?__a=1". 它工作正常,postman向我显示了一个json响应,其中包含如下信息:Php 如何从instagram.com/user/?\uu a=1获取json,php,json,curl,instagram,Php,Json,Curl,Instagram,我正在使用curl with postman通过此URL从Instagram用户处获取json“https://www.instagram.com/kiddothegame/?__a=1". 它工作正常,postman向我显示了一个json响应,其中包含如下信息: {"seo_category_infos":[["Beauty","beauty"],["Dance & Performance","
{"seo_category_infos":[["Beauty","beauty"],["Dance & Performance","dance_and_performance"],["Fitness","fitness"],["Food & Drink","food_and_drink"],["Home & Garden","home_and_garden"],["Music","music"],["Visual Arts","visual_arts"]],.....
现在,我尝试使用PHP执行相同的请求:
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://www.instagram.com/kiddothegame/?__a=1',
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);
curl_close($curl);
echo $response;
回波结果是:
string(52678) "
"
奇怪的是,所有的字符都是空格
我遗漏了什么?也许请求有所不同。这段PHP代码是由Postman自动生成的,还是您自己编写的?而且您似乎没有检查任何cURL错误……对我来说,它不提供JSON,而是将我发送到登录页面。我以前也遇到过类似的问题,似乎是有限的。如果您多次运行请求,Postman还会给您JSON吗?