本文整理汇总了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();
}
示例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