本文整理汇总了PHP中Instagram::getAccessTokenFromCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Instagram::getAccessTokenFromCode方法的具体用法?PHP Instagram::getAccessTokenFromCode怎么用?PHP Instagram::getAccessTokenFromCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Instagram
的用法示例。
在下文中一共展示了Instagram::getAccessTokenFromCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Instagram
*
*/
session_start();
require_once 'config.php';
require_once 'Class.Instagram.php';
if (isset($_GET['error']) && $_GET['error'] != "") {
echo "You Need to grant access to the application in order to continue!";
exit;
}
if (isset($_GET['code']) && $_GET['code'] != "") {
/**
* InstaGram redirected to our URL with Code
* So use this code to get Access Token from InstaGram for further opeartions
*/
$instgram = new Instagram();
$accesstoken = $instgram->getAccessTokenFromCode($_GET['code']);
if ($accesstoken != "") {
$_SESSION['AccessToken'] = $accesstoken;
$_SESSION['UserId'] = $instgram->getUserId();
$_SESSION['FullName'] = $instgram->getUserFullName();
$_SESSION['Thumbnail'] = $instgram->getUserThumb();
header("Location: index.php");
exit;
}
}
/**
* If op is set to "getauth" it means user has not been authorized so we need to redirect user to Instagram server
* and get authorization code
*
*/
if (isset($_GET['op']) && $_GET['op'] == "getauth") {