本文整理汇总了PHP中Instagram::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Instagram::getUser方法的具体用法?PHP Instagram::getUser怎么用?PHP Instagram::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Instagram
的用法示例。
在下文中一共展示了Instagram::getUser方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Instagram
<?php
require_once 'instagram.class.php';
$instagram = new Instagram(array('apiKey' => '', 'apiSecret' => '', 'apiCallback' => ''));
if ($_COOKIE['ulttoken']) {
$instagram->setAccessToken($_COOKIE['ulttoken']);
$user = $instagram->getUser()->data;
?>
<div id="content">
<?php
}
echo "<div class=\"feed-photos\">\n<div class=\"photo-grid \">";
require_once 'con.php';
示例2: register_instagram
function register_instagram()
{
$options_check = get_option('si_options');
$config = array('apiKey' => $options_check['instagram_app_id'], 'apiSecret' => $options_check['instagram_app_secret'], 'apiCallback' => site_url() . '/wp-admin/admin-ajax.php?action=register_instagram');
if (isset($_GET['code'])) {
$options_check = get_option('si_options');
$instagram = new Instagram($config);
$token = $instagram->getOAuthToken($_GET['code']);
if (isset($token->access_token)) {
update_option('si_oauth', $token->access_token);
} else {
update_option('si_oauth', 'error');
}
}
if (strlen($options_check['instagram_app_id']) > 0 && strlen($options_check['instagram_app_secret']) > 0) {
$set = 1;
} else {
$set = 0;
}
$auth_check = get_option('si_oauth');
if (strlen($auth_check) > 0) {
$auth = 1;
} else {
$auth = 0;
}
?>
<head>
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<link href='<?php
echo plugins_url('admin/assets/css/iframe.css', __FILE__);
?>
' rel='stylesheet' type='text/css'>
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
</head>
<?php
if ($auth == 0) {
$instagram = new Instagram($config);
// Display the login button
$loginUrl = $instagram->getLoginUrl();
?>
<div class="instagram">
<span><i class="fa fa-instagram"></i></span><a href="<?php
echo $loginUrl;
?>
" target="_blank">Login with Instagram</a>
</div>
<script>
setTimeout(function(){ location.reload(); },5000);
</script>
<?php
} else {
if ($auth_check == 'error') {
//Error with auth
$instagram = new Instagram($config);
// Display the login button
$loginUrl = $instagram->getLoginUrl();
?>
<p>Whoops! It looks like there's a problem with your App credentials. Please check your entries in Step 02 and then use the button below to authorize the app once again.</p>
<div class="instagram">
<span><i class="fa fa-instagram"></i></span><a href="<?php
echo $loginUrl;
?>
" target="_blank">Login with Instagram</a>
</div>
<script>
setTimeout(function(){ location.reload(); },5000);
</script>
<?php
} else {
//We have auth credentials, check to make sure they haven't expired
$instagram = new Instagram($config);
$instagram->setAccessToken($auth_check);
$user = $instagram->getUser();
if (isset($user->data->username)) {
?>
<h2>Success!</h2>
<p>Alright! You're all set up and ready to go!</p>
<?php
} else {
//Auth token has expired. Show login button instead.
$instagram = new Instagram($config);
// Display the login button
$loginUrl = $instagram->getLoginUrl();
?>
<p>Whoops! It looks like your authorization has expired. Please use the button below to authorize the app once again.</p>
<div class="instagram">
<span><i class="fa fa-instagram"></i></span><a href="<?php
echo $loginUrl;
?>
" target="_blank">Login with Instagram</a>
</div>
<script>
setTimeout(function(){ location.reload(); },5000);
</script>
<?php
}
//.........这里部分代码省略.........
示例3: instagramLogin
public function instagramLogin()
{
$instagram = new Instagram();
if (Input::has('code')) {
$instagram->storeSession();
$user = $instagram->getUser();
return $user;
} else {
return $instagram->getRedirectURL();
}
}
示例4: get_settings
<div class="unit one-of-three">
<div class="phoneSegment">
<div class="phoneNumber">
<?php
echo get_settings('phone_number');
?>
</div>
<a href="https://hbahairdesign.mylocalsalon.com/onlinebooking/" class="bookOnline">Book Online</a>
</div>
<div class="instagramSection">
<?php
$instagram = new Instagram(array('apiKey' => get_option('HBA_INSTA_CLIENT_ID'), 'apiSecret' => get_option('HBA_INSTA_CLIENT_SECRET'), 'apiCallback' => site_url() . '/wp-admin/options-general.php?page=themeOptions.php'));
$instagram->setAccessToken(get_settings('HBA_INSTA_AUTH'));
$user = $instagram->getUser();
$userLike = $instagram->getUserMedia();
?>
<a href="http://instagram.com/<?php
echo $user->data->username;
?>
" class="instagramLink">@hbahair</a>
<a href="http://instagram.com/<?php
echo $user->data->username;
?>
" class="instagramUsLink">Instagram Us!</a>
<div class="instagramPicture">
<img src="<?php
echo $userLike->data[0]->images->standard_resolution->url;
示例5: array
<?php
session_start();
require_once 'instagram.php';
$config = array('client_id' => 'a8bca2257b204c4d865fe0337853caa3', 'client_secret' => '10c22646b9b143f1bb11746fd9dbb6a5', 'grant_type' => 'authorization_code', 'redirect_uri' => 'http://digiworldcom.com/instagram/api.php');
$instagram = new Instagram($config);
$accessToken = $instagram->getAccessToken();
$_SESSION['InstagramAccessToken'] = $accessToken;
$instagram->setAccessToken($_SESSION['InstagramAccessToken']);
$userinfo = $instagram->getUser($_SESSION['InstagramAccessToken']);
$ures = json_decode($userinfo, true);
?>
<html>
<head>
<title>Instagram API</title>
</head>
<body>
<h1 align="center"><?php
echo $ures['data']['username'];
?>
(<?php
echo $ures['data']['full_name'];
?>
)</h1>
<div align="center"><img src="<?php
echo $ures['data']['profile_picture'];
?>
" /></div>
<div align="center">User ID: <?php
echo $ures['data']['id'];