Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Json 从instagram api获取配置文件图片_Json_Instagram_Instagram Api - Fatal编程技术网

Json 从instagram api获取配置文件图片

Json 从instagram api获取配置文件图片,json,instagram,instagram-api,Json,Instagram,Instagram Api,我正在尝试使用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); $jso

我正在尝试使用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);
但这将返回一个空白页。我的代码怎么了?

试试看

$json = json_decode($get);
return $json->data->profile_picture;

可能您处于沙箱模式。 在此模式下,您只能获取您邀请的用户的媒体(最多10个)。他们不会收到通知,但应在以下地址接受请求: