简体   繁体   English

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

[英]Instagram api getting photos without getting link

I need get photos and descriptions from registered instagram. 我需要从注册的instagram获取照片和说明。 As I understand from docs on github https://github.com/cosenary/Instagram-PHP-API You need put auth link first ant then using auth token after click on it you are redirected to some callback url, where you can get media then. 据我从github https://github.com/cosenary/Instagram-PHP-API上的文档了解到,您需要先放置auth链接,然后单击auth令牌后再单击它,然后将您重定向到一些回调URL,您可以在其中获取媒体然后。 But can I somehow login automatically without clicking link?? 但是我可以不用单击链接就以某种方式自动登录吗? I have some 我有一些

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

with my data get after registration in https://www.instagram.com/developer/ . 我的数据在https://www.instagram.com/developer/注册后获得。 How can I get what I want? 我如何得到想要的东西?

I guess try something like this: 我猜尝试这样的事情:

        $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

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

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

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