【问题标题】:get profile picture from instagram api从 instagram api 获取个人资料图片
【发布时间】:2015-08-13 11:39:15
【问题描述】:

我正在尝试使用 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 instagram instagram-api


    【解决方案1】:

    试试

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

    【讨论】:

      【解决方案2】:

      您可能处于沙盒模式。 在此模式下,您只能获取您邀请的用户(最多 10 个)的媒体。他们不会收到通知,但他们会在这个地址接受请求:https://www.instagram.com/developer/clients/sandbox_invites/

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-06-24
        • 1970-01-01
        • 1970-01-01
        • 2014-09-15
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多