本文整理汇总了PHP中Instagram::getUserId方法的典型用法代码示例。如果您正苦于以下问题:PHP Instagram::getUserId方法的具体用法?PHP Instagram::getUserId怎么用?PHP Instagram::getUserId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Instagram
的用法示例。
在下文中一共展示了Instagram::getUserId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Instagram
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") {
header("Location: " . sprintf($urlconfig['authorization_url'], $appconfig['client_id'], $appconfig['redirect_url']));
exit;
}
示例2: isset
<?php
require_once './api/Instagram.class.php';
$username = isset($_GET['user']) ? $_GET['user'] : NULL;
$count = isset($_GET['count']) && is_numeric($_GET['count']) ? $_GET['count'] : 12;
$token = '<PUT YOUR TOKEN HERE>';
$api = new Instagram($token);
$id = $api->getUserId($username);
$photos = $api->getUserPhotos($id, $count);
header('Content-type: application/json');
echo $photos;