Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 <?php
- 2
- 3 include __DIR__.'/../vendor/autoload.php';
- 4 require '../src/Instagram.php';
- 5
- 6 /////// CONFIG ///////
- 7 $username = 'mona_of_green_gables';
- 8 $password = '';
- 9 $debug = false;
- 10 //////////////////////
- 11
- 12 // THIS IS AN EXAMPLE OF HOW TO USE NEXT_MAX_ID TO PAGINATE
- 13 // IN THIS EXAMPLE, WE ARE RETRIEVING SELF FOLLOWERS
- 14 // BUT THE PROCESS IS SIMILAR IN OTHER REQUESTS
- 15
- 16 $i = new \InstagramAPI\Instagram($debug);
- 17
- 18 $i->setUser($username, $password);
- 19
- 20 //$buzzfeed_id = $i->getUsernameId('buzzfeed');
- 21 //$mona_id = $i->getUsernameId('mona_of_green_gables');
- 22 try {
- 23 $i->login();
- 24 } catch (Exception $e) {
- 25 echo 'something went wrong '.$e->getMessage()."\n";
- 26 exit(0);
- 27 }
- 28 try {
- 29 /*
- 30 $helper = null;
- 31 $followers = [];
- 32
- 33 do {
- 34 if (is_null($helper)) {
- 35 $helper = $i->getSelfUserFollowers();
- 36 } else {
- 37 $helper = $i->getSelfUserFollowers($helper->getNextMaxId());
- 38 }
- 39
- 40 $followers = array_merge($followers, $helper->getUsers());
- 41 } while (!is_null($helper->getNextMaxId()));
- 42
- 43 echo "My followers: \n";
- 44 foreach ($followers as $follower) {
- 45 # echo '- '.$follower->getUsername()."\n";
- 46 }
- 47 */
- 48 /*
- 49 $tag_helper = null;
- 50 $tags = [];
- 51
- 52 do {
- 53 if (is_null($tag_helper)) {
- 54 $tag_helper = $i->getUserTags(53112486);
- 55 } else {
- 56 $tag_helper = $i->getUserTags($tag_helper->getNextMaxId());
- 57 }
- 58 $tags = array_merge($tags, $tag_helper->getUser());
- 59 } while (!is_null($tag_helper->getNextMaxId()));
- 60
- 61 foreach ($tags as $tag){
- 62 echo '- '.$tag->getTagInfo()."\n";
- 63 }
- 64 */
- 65 //echo "buzzfeed user id is $buzzfeed_id \n";
- 66 //echo "monamona user id is $mona_id \n";
- 67 $i->getMediaLikers(1462813261661883124);
- 68 die(var_dump($i));
- 69 /*
- 70 foreach ($i as $liker){
- 71 json_decode($liker);
- 72 }
- 73 */
- 74 #$i->getUserTags(53112486);
- 75 //json_decode($i, true);
- 76 } catch (Exception $e) {
- 77 echo $e->getMessage();
- 78 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement