<?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);
<?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 :('; }