Last active
June 14, 2019 19:49
-
-
Save cosenary/3287237 to your computer and use it in GitHub Desktop.
Instagram PHP API - Likes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 :('; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi,
could you give me an "MEDIA_ID" example please because i saw many id's in "$photos = $instagram->getTagMedia('istanbul',100);". for example first iteration of this response :
(
[attribution] =>
[videos] => stdClass Object
(
[low_bandwidth] => stdClass Object
(
[url] => https://scontent.cdninstagram.com/hphotos-xpf1/l/t50.2886-16/11199317_914648191918614_1811524043_s.mp4
[width] => 480
[height] => 480
)
Martı[from] => stdClass Object
(
[username] => mstdgr
[profile_picture] => https://igcdn-photos-c-a.akamaihd.net/hphotos-ak-xfa1/t51.2885-19/11142802_952015994829938_1172025133_a.jpg
[id] => 243281967
[full_name] => -Broker-
)
)