我正在尝试使用Instagram Api获取个人资料图片。我尝试了以下代码:
function getpho($userid)
{
$userid = "000000";
$token = "my access token";
$url = "https://api.instagram.com/v1/users/".$userid."/?access_token=".$token;
$get = file_get_contents($url);
$json = json_decode($get);
foreach($json->data as $user)
{
return $user->profile_picture;
}
}
echo getpho($userid);
但是这会返回一个空白页面。我的代码出了什么问题?
答案 0 :(得分:0)
试
$json = json_decode($get);
return $json->data->profile_picture;
答案 1 :(得分:0)
可能你处于沙盒模式。 在此模式下,您只能获得您邀请的用户的媒体(最多10个)。他们不会收到通知,但他们将接受此地址的请求:https://www.instagram.com/developer/clients/sandbox_invites/