本文整理汇总了PHP中Instagram::getAccessCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Instagram::getAccessCode方法的具体用法?PHP Instagram::getAccessCode怎么用?PHP Instagram::getAccessCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Instagram
的用法示例。
在下文中一共展示了Instagram::getAccessCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: nextend_api_auth_flow
function nextend_api_auth_flow()
{
$api_key = NextendRequest::getVar('api_key');
$api_secret = NextendRequest::getVar('api_secret');
$redirect_uri = NextendRequest::getVar('redirect_uri');
if (session_id() == "") {
@session_start();
}
if (!$api_key || !$api_secret || !$redirect_uri) {
$api_key = isset($_SESSION['api_key']) ? $_SESSION['api_key'] : null;
$api_secret = isset($_SESSION['api_secret']) ? $_SESSION['api_secret'] : null;
$redirect_uri = isset($_SESSION['redirect_uri']) ? $_SESSION['redirect_uri'] : null;
} else {
$_SESSION['api_key'] = $api_key;
$_SESSION['api_secret'] = $api_secret;
$_SESSION['redirect_uri'] = $redirect_uri;
}
if ($api_key && $api_secret) {
require_once dirname(__FILE__) . "/api/Instagram.php";
$config = array('client_id' => $api_key, 'client_secret' => $api_secret, 'redirect_uri' => $redirect_uri, 'grant_type' => 'authorization_code');
$instagram = new Instagram($config);
$accessCode = $instagram->getAccessCode();
if ($accessCode === null) {
$instagram->openAuthorizationUrl();
} else {
$accessToken = $instagram->getAccessToken();
unset($_SESSION['api_key']);
unset($_SESSION['api_secret']);
unset($_SESSION['redirect_uri']);
echo '<script type="text/javascript">';
echo 'window.opener.setToken("' . $accessToken . '");';
echo '</script>';
}
}
}