Last active
December 25, 2020 07:13
-
-
Save cosenary/8322459 to your computer and use it in GitHub Desktop.
Instagram API class - follow user example
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' // must point to success.php | |
)); | |
// set user's accesstoken (can be received after authentication) | |
$instagram->setAccessToken("2823787.9687902.21u77429n3r79o08233122306fa78902"); | |
// follow user (snoopdogg) | |
$result = $instagram->modifyRelationship('follow', 1574083); | |
// receive the list of users this user follows | |
$follows = $instagram->getUserFollows(); | |
// dump response object | |
echo '<pre>'; | |
print_r($follows); | |
echo '<pre>'; |
Even though you are adding scope as likes+relationships, instagram will give you basic permissions only. Instagram does not give you the permission to update relationship, post like and comments until you submit the app for review. With basic permissions you can view the people who liked your posts but you can not make like or comment to a post and can not update relationship status like follow/unfollow/block/unblock/ignore. For more details on submitting you app refer this
https://help.instagram.com/contact/185819881608116
does this follow somebody's followers?
ı have a instagram follow.php like.php but the user free 👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can anybody please tell me how do I get the ID?
like the ID you used here 1574083
I have never used Instagram and now I have to make an instagram app for a client. I don't know what's with the user profile IDs and how to get them. Since most users only have this username eg
username:ammarhasme