logikinc
10/15/2015 - 5:36 PM

Instagram PHP API - Likes

Instagram PHP API - Likes

<?php

require 'Instagram.php';
use MetzWeb\Instagram\Instagram;

$instagram = new Instagram(array(
  'apiKey'      => 'YOUR_APP_KEY',
  'apiSecret'   => 'YOUR_APP_SECRET',
  'apiCallback' => 'YOUR_APP_CALLBACK'
));

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