本文整理汇总了PHP中Instagram::openAuthorizationUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Instagram::openAuthorizationUrl方法的具体用法?PHP Instagram::openAuthorizationUrl怎么用?PHP Instagram::openAuthorizationUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Instagram
的用法示例。
在下文中一共展示了Instagram::openAuthorizationUrl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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>';
}
}
}
示例2: array
* URI callback that you must set up with Instagram as the return address
* for your application on their developers section:
* http://instagr.am/developer/
*
*
* If you have any question, check http://mauriciocuenca.com/ for the
* latest updates
**/
require_once 'Instagram.php';
/**
* Configuration params, make sure to write exactly the ones
* instagram provide you at http://instagr.am/developer/
*/
$config = array('client_id' => 'e1d602f8517645749de38593dbf9ad25', 'client_secret' => '63dbfae2a6444956802e269384fc05cc', 'grant_type' => 'authorization_code', 'redirect_uri' => 'http://www.HoopsMap.com/instagram/');
/**
* This is how a wrong response looks like
* array(1) { ["InstagramOAuthToken"]=> string(89) "{"code": 400, "error_type": "OAuthException", "error_message": "No matching code found."}" }
*/
session_start();
/**
if (isset($_SESSION['InstagramAccessToken']) && !empty($_SESSION['InstagramAccessToken'])) {
header('Location: index.php');
die();
}
**/
// Instantiate the API handler object
$instagram = new Instagram($config);
$instagram->openAuthorizationUrl();
?>
示例3: login
public function login()
{
$instagram = new Instagram($this->config);
$instagram->openAuthorizationUrl();
}