本文整理匯總了PHP中Instagram::likeMedia方法的典型用法代碼示例。如果您正苦於以下問題:PHP Instagram::likeMedia方法的具體用法?PHP Instagram::likeMedia怎麽用?PHP Instagram::likeMedia使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Instagram
的用法示例。
在下文中一共展示了Instagram::likeMedia方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
<?php
/*
Example use of aimee.instagram.class.php
*/
require_once 'aimee.instagram.class.php';
// tags to query
$tags = array('englishbulldog', 'igbulldogs_worldwide');
// initiate class
$ig = new Instagram();
// set your access token
$ig->setAccessToken('access_token');
// loop through tags
foreach ($tags as $tag) {
// searches tag
$tag = $ig->searchTag($tag);
// shuffles json data
shuffle($tag['data']);
// likes the randomly shuffled tag!
$ig->likeMedia($tag['data'][0]['id']);
}
// free up some memory
unset($ig);
示例2: Instagram
<?php
require 'instagram.class.php';
$instagram = new Instagram(array('apiKey' => '563239a4c8214a85b9153d00c1a2a00f', 'apiSecret' => '4f6256459c5c417dbe48b8609e1cc123', 'apiCallback' => 'http://localhost/ws/Works/instagram/phpInsta/'));
$token = 'USER_ACCESS_TOKEN';
$instagram->setAccessToken($token);
$id = 'MEDIA_ID';
$result = $instagram->likeMedia($id);
if ($result->meta->code === 200) {
echo 'Success! The image was added to your likes.';
} else {
echo 'Something went wrong :(';
}