本文整理匯總了PHP中Instagram::getUserLikes方法的典型用法代碼示例。如果您正苦於以下問題:PHP Instagram::getUserLikes方法的具體用法?PHP Instagram::getUserLikes怎麽用?PHP Instagram::getUserLikes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Instagram
的用法示例。
在下文中一共展示了Instagram::getUserLikes方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Instagram
<?php
require '../instagram.class.php';
// Initialize class
$instagram = new Instagram(array('apiKey' => '63239a4c8214a85b9153d00c1a2a00f', 'apiSecret' => '4f6256459c5c417dbe48b8609e1cc123', 'apiCallback' => 'http://localhost/ws/Works/instagram/phpInsta2/example/success.php'));
// Receive OAuth code parameter
$code = $_GET['code'];
// Check whether the user has granted access
if (true === isset($code)) {
// Receive OAuth token object
$data = $instagram->getOAuthToken($code);
echo 'Your username is: ' . $data->user->username;
// Store user access token
$instagram->setAccessToken($data);
// Now you can call all authenticated user methods
// Get all user likes
$likes = $instagram->getUserLikes();
// Display all user likes
foreach ($likes->data as $entry) {
echo "<img src=\"{$entry->images->thumbnail->url}\">";
}
} else {
// Check whether an error occurred
if (true === isset($_GET['error'])) {
echo 'An error occurred: ' . $_GET['error_description'];
}
}
示例2: array
$scopes = array('basic', 'likes', 'comments', 'relationships');
?>
<a href="<?php
echo $ig->getLoginUrl($scopes);
?>
">Login</a>
<?php
$users = $ig->searchUser('maanmughal87', 1);
echo '<pre>users:';
print_r($users);
$code = $_GET['code'];
$data = $ig->getOAuthToken($code);
echo '<pre>';
print_r($data);
// set user access token
$ig->setAccessToken($data);
// get all user likes
$likes = $ig->getUserLikes();
// take a look at the API response
echo '<pre>likes';
print_r($likes);
echo '<pre>';
// get all user likes
$follows = $ig->getUserFollows();
// take a look at the API response
echo '<pre>follows';
print_r($follows);
echo '<pre>';
$followship = $ig->modifyRelationship('follow', 2057410915);
echo '<br />followship';
print_r($followship);