繁体   English   中英

Instagram API获取照片但未获取链接

[英]Instagram api getting photos without getting link

我需要从注册的instagram获取照片和说明。 据我从github https://github.com/cosenary/Instagram-PHP-API上的文档了解到,您需要先放置auth链接,然后单击auth令牌后再单击它,然后将您重定向到一些回调URL,您可以在其中获取媒体然后。 但是我可以不用单击链接就以某种方式自动登录吗? 我有一些

$instagram = new Instagram(array(
    'apiKey'      => 'apiKey',
    'apiSecret'   => 'apiSecret',
    'apiCallback' => 'apiCallback there'
));

我的数据在https://www.instagram.com/developer/注册后获得。 我如何得到想要的东西?

我猜尝试这样的事情:

        $userid = "User-ID-Goes-Here";
        $accessToken = "Token-Goes-Here";

    // Gets our data
    function fetchData($url){
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_TIMEOUT, 20);
         $result = curl_exec($ch);
         curl_close($ch); 
         return $result;
    }

    // Pulls and parses data.
    $result = fetchData("https://api.instagram.com/v1/users/{$userid}/media/recent/?access_token={$accessToken}");
    $result = json_decode($result);
    //use data here

资料来源: http : //blueprintinteractive.com/blog/how-instagram-api-fancybox-simplified

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM