Advertisement
Guest User

Untitled

a guest
Nov 26th, 2016
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.56 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <?php
  6.  
  7. include '/home/ubuntu/vendor/autoload.php';
  8. require '/home/ubuntu/vendor/mgp25/instagram-php/src/Instagram.php';
  9.  
  10. $userLook = $_REQUEST['instname'];
  11.  
  12. /////// CONFIG ///////
  13. //$userLook = 'cambooleg';
  14. $username = 'camb0leg';
  15. $password = 'pekaes';
  16. $debug = false;
  17. $web_pref = 'https://www.instagram.com/';
  18. $eUsers = Array();
  19. $iUsers = Array();
  20. $bUsers = Array();
  21. $fUsers = Array();
  22. $gUsers = Array();
  23. $eUsersStr = "";
  24. $iUsersStr = "";
  25. //////////////////////
  26.  
  27.  
  28. $i = new \InstagramAPI\Instagram($username, $password, $debug);
  29.  
  30. try {
  31. $i->login();
  32. } catch (Exception $e) {
  33. echo 'something went wrong '.$e->getMessage()."\n";
  34. exit(0);
  35. }
  36.  
  37. $usernameId = $i->getUsernameId($userLook);
  38.  
  39. $i->getUserFollowings($usernameId, $maxid = null);
  40. try {
  41. $helper = null;
  42. $followers = [];
  43. do {
  44. if (is_null($helper)) {
  45. $helper = $i->getUserFollowers($usernameId);
  46. } else {
  47. $helper = $i->getUserFollowers($usernameId,$helper->getNextMaxId());
  48. }
  49. $followers = array_merge($followers, $helper->getFollowers());
  50. } while (!is_null($helper->getNextMaxId()));
  51.  
  52. foreach ($followers as $follower) {
  53. array_push($eUsers, $follower);
  54. }
  55. } catch (Exception $e) {
  56. echo $e->getMessage();
  57. }
  58.  
  59. try {
  60. $helper = null;
  61. $following = [];
  62. do {
  63. if (is_null($helper)) {
  64. $helper = $i->getUserFollowings($usernameId);
  65. } else {
  66. $helper = $i->getUserFollowings($usernameId,$helper->getNextMaxId());
  67. }
  68. $following = array_merge($following, $helper->getFollowings());
  69. } while (!is_null($helper->getNextMaxId()));
  70.  
  71. foreach ($following as $follow) {
  72. array_push($iUsers, $follow);
  73. }
  74. } catch (Exception $e) {
  75. echo $e->getMessage();
  76. }
  77.  
  78. foreach ($eUsers as $eUser) {
  79. $eUsersStr .= $eUser->getUsernameId() . ";";
  80. }
  81.  
  82. foreach ($iUsers as $iUser) {
  83. $iUsersStr .= $iUser->getUsernameId() . ";";
  84. }
  85.  
  86. foreach ($iUsers as $iUser) {
  87. $pos1 = stripos($eUsersStr, $iUser->getUsernameId());
  88. if ($pos1 === false) {
  89. array_unshift($bUsers,$iUser);
  90. } else {
  91. array_unshift($fUsers,$iUser);
  92. }
  93. }
  94.  
  95. foreach ($eUsers as $eUser) {
  96. $pos1 = stripos($iUsersStr, $eUser->getUsernameId());
  97. if ($pos1 === false) {
  98. array_unshift($gUsers,$eUser);
  99. }
  100. }
  101.  
  102. $strIUsers = "Total following: " . count($iUsers);
  103. $strEUsers = "Total followers: " . count($eUsers);
  104. $strBUsers = "Total following unfollowers: " . count($bUsers);
  105. $strGUsers = "Total unfollowing followers: " . count($gUsers);
  106. $strFUsers = "Total following followers: " . count($fUsers);
  107.  
  108. //echo "Total following: ", count($iUsers), "<br>", "\n";
  109. //echo "Total followers: ", count($eUsers), "<br>", "\n";
  110. //echo "Total suckers: ", count($bUsers), "<br>", "\n";
  111. //echo "Total good: ", count($gUsers), "<br>", "\n";
  112. //echo "Total friends: ", count($fUsers), "<br>", "\n";
  113.  
  114. session_start();
  115.  
  116. $_SESSION['iUsers'] = $bUsers;
  117. $_SESSION['eUsers'] = $bUsers;
  118. $_SESSION['bUsers'] = $bUsers;
  119. $_SESSION['gUsers'] = $bUsers;
  120. $_SESSION['fUsers'] = $bUsers;
  121.  
  122. echo '<br /><a href="iUsers.php" target="_blank">', $strIUsers, ' </a>';
  123. echo '<br /><a href="eUsers.php" target="_blank">', $strEUsers, ' </a>';
  124. echo '<br /><a href="sUsers.php" target="_blank">', $strBUsers, ' </a>';
  125. echo '<br /><a href="gUsers.php" target="_blank">', $strGUsers, ' </a>';
  126. echo '<br /><a href="fUsers.php" target="_blank">', $strFUsers, ' </a>';
  127.  
  128. ?>
  129.  
  130. </body>
  131. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement