当前位置: 首页>>代码示例>>PHP>>正文


PHP Instagram::authorizeUrl方法代码示例

本文整理汇总了PHP中Instagram::authorizeUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Instagram::authorizeUrl方法的具体用法?PHP Instagram::authorizeUrl怎么用?PHP Instagram::authorizeUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Instagram的用法示例。


在下文中一共展示了Instagram::authorizeUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: displayEditInstagram

 /**
  * displayEditInstagram 
  * 
  * @return void
  */
 function displayEditInstagram()
 {
     $this->displayHeader();
     $config = getInstagramConfigData();
     $callbackUrl = getDomainAndDir();
     $callbackUrl .= 'settings.php?view=instagram';
     $accessToken = getUserInstagramAccessToken($this->fcmsUser->id);
     $instagram = new Instagram($config['instagram_client_id'], $config['instagram_client_secret'], $accessToken);
     if (!$accessToken) {
         $url = $instagram->authorizeUrl($callbackUrl, array('basic', 'comments', 'likes', 'relationships'));
         $status = T_('Not Connected');
         $link = '<a href="' . $url . '">' . T_('Connect') . '</a>';
     } else {
         try {
             $feed = $instagram->get('users/self');
         } catch (InstagramApiError $e) {
             die($e->getMessage());
         }
         $status = sprintf(T_('Currently connected as: %s'), $feed->data->username);
         $status .= '<br/><br/><img src="' . $feed->data->profile_picture . '"/>';
         $link = '<a class="disconnect" href="?revoke=instagram">' . T_('Disconnect') . '</a>';
     }
     echo '
     <div class="social-media-connect">
         <img class="icon" src="ui/img/instagram.png" alt="Instagram"/>
         <h2>Instagram</h2>
         <p>' . T_('Connecting with Instagram will allow you to:') . '</p>
         <ul>
             <li>' . T_('Share your Instagram photos with this site.') . '</li>
         </ul>
         <div class="status">' . $status . '</div>
         <div class="action">' . $link . '</div>
     </div>';
     $this->displayFooter();
 }
开发者ID:lmcro,项目名称:fcms,代码行数:40,代码来源:settings.php

示例2: isset

<?php

session_start();
require_once 'src/config.php';
require_once 'src/Instagram.php';
$access_token = isset($_SESSION['access_token']) ? $_SESSION['access_token'] : null;
$instagram = new Instagram(CLIENT_ID, CLIENT_SECRET, $access_token);
if (!$access_token) {
    // If there is no access token in the session, let's have the user authenticate our application...
    /*
    /   You pass the Redirect Uri you registered with your app and an array of "scope" (aka permissions) you
    /   want to grab from the user. There is also a third parameter "response_type" which defaults to "code"
    */
    $loginUrl = $instagram->authorizeUrl(REDIRECT_URI, array('basic', 'comments', 'likes', 'relationships'));
} else {
    try {
        $feed = $instagram->get('users/self/feed');
    } catch (InstagramApiError $e) {
        die($e->getMessage());
    }
}
?>

<?php 
if (isset($loginUrl)) {
    ?>
<a href="<?php 
    echo $loginUrl;
    ?>
">Log in</a>
<?php 
开发者ID:yuva2achieve,项目名称:instagram-php-oauth,代码行数:31,代码来源:index.php


注:本文中的Instagram::authorizeUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。