【问题标题】:Instagram API only returning data with selfInstagram API 仅返回带有自身的数据
【发布时间】:2015-06-26 21:41:16
【问题描述】:

我正在实施 Instagram API。它仅通过 self 关键字为我自己的用户返回数据。我应该怎么做才能从访问我网站的其他用户那里获取数据。

作品:

https://api.instagram.com/v1/users/self/?access_token=ACCESS_TOKEN

没用

https://api.instagram.com/v1/users/ABC_USER/?access_token=ACCESS_TOKEN

我的完整代码是这样的。

$result = fetchData("https://api.instagram.com/v1/users/{user-id}/?access_token=ACCESS_TOKEN");
 $result = json_decode($result);
  print_r($result);

function fetchData($url){
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_TIMEOUT, 20);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
  $result = curl_exec($ch);
  if(curl_error($ch))
{
echo curl_error($ch);
}
return $result;
curl_close($ch);
}

【问题讨论】:

    标签: php curl instagram instagram-api


    【解决方案1】:

    {user-id} 应该是 id,而不是 username

    通常是一个数字,试试这个,它会工作:

    https://api.instagram.com/v1/users/3/?access_token=ACCESS_TOKEN
    

    (如果你想查找用户名的user-id,请使用用户搜索API搜索用户名,然后获取用户ID,然后在上面的API中使用)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-29
      • 1970-01-01
      • 2018-06-05
      • 1970-01-01
      • 1970-01-01
      • 2015-11-30
      相关资源
      最近更新 更多