Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <?php
- include '/home/ubuntu/vendor/autoload.php';
- require '/home/ubuntu/vendor/mgp25/instagram-php/src/Instagram.php';
- $userLook = $_REQUEST['instname'];
- /////// CONFIG ///////
- //$userLook = 'cambooleg';
- $username = 'camb0leg';
- $password = 'pekaes';
- $debug = false;
- $web_pref = 'https://www.instagram.com/';
- $eUsers = Array();
- $iUsers = Array();
- $bUsers = Array();
- $fUsers = Array();
- $gUsers = Array();
- $eUsersStr = "";
- $iUsersStr = "";
- //////////////////////
- $i = new \InstagramAPI\Instagram($username, $password, $debug);
- try {
- $i->login();
- } catch (Exception $e) {
- echo 'something went wrong '.$e->getMessage()."\n";
- exit(0);
- }
- $usernameId = $i->getUsernameId($userLook);
- $i->getUserFollowings($usernameId, $maxid = null);
- try {
- $helper = null;
- $followers = [];
- do {
- if (is_null($helper)) {
- $helper = $i->getUserFollowers($usernameId);
- } else {
- $helper = $i->getUserFollowers($usernameId,$helper->getNextMaxId());
- }
- $followers = array_merge($followers, $helper->getFollowers());
- } while (!is_null($helper->getNextMaxId()));
- foreach ($followers as $follower) {
- array_push($eUsers, $follower);
- }
- } catch (Exception $e) {
- echo $e->getMessage();
- }
- try {
- $helper = null;
- $following = [];
- do {
- if (is_null($helper)) {
- $helper = $i->getUserFollowings($usernameId);
- } else {
- $helper = $i->getUserFollowings($usernameId,$helper->getNextMaxId());
- }
- $following = array_merge($following, $helper->getFollowings());
- } while (!is_null($helper->getNextMaxId()));
- foreach ($following as $follow) {
- array_push($iUsers, $follow);
- }
- } catch (Exception $e) {
- echo $e->getMessage();
- }
- foreach ($eUsers as $eUser) {
- $eUsersStr .= $eUser->getUsernameId() . ";";
- }
- foreach ($iUsers as $iUser) {
- $iUsersStr .= $iUser->getUsernameId() . ";";
- }
- foreach ($iUsers as $iUser) {
- $pos1 = stripos($eUsersStr, $iUser->getUsernameId());
- if ($pos1 === false) {
- array_unshift($bUsers,$iUser);
- } else {
- array_unshift($fUsers,$iUser);
- }
- }
- foreach ($eUsers as $eUser) {
- $pos1 = stripos($iUsersStr, $eUser->getUsernameId());
- if ($pos1 === false) {
- array_unshift($gUsers,$eUser);
- }
- }
- $strIUsers = "Total following: " . count($iUsers);
- $strEUsers = "Total followers: " . count($eUsers);
- $strBUsers = "Total following unfollowers: " . count($bUsers);
- $strGUsers = "Total unfollowing followers: " . count($gUsers);
- $strFUsers = "Total following followers: " . count($fUsers);
- //echo "Total following: ", count($iUsers), "<br>", "\n";
- //echo "Total followers: ", count($eUsers), "<br>", "\n";
- //echo "Total suckers: ", count($bUsers), "<br>", "\n";
- //echo "Total good: ", count($gUsers), "<br>", "\n";
- //echo "Total friends: ", count($fUsers), "<br>", "\n";
- session_start();
- $_SESSION['iUsers'] = $bUsers;
- $_SESSION['eUsers'] = $bUsers;
- $_SESSION['bUsers'] = $bUsers;
- $_SESSION['gUsers'] = $bUsers;
- $_SESSION['fUsers'] = $bUsers;
- echo '<br /><a href="iUsers.php" target="_blank">', $strIUsers, ' </a>';
- echo '<br /><a href="eUsers.php" target="_blank">', $strEUsers, ' </a>';
- echo '<br /><a href="sUsers.php" target="_blank">', $strBUsers, ' </a>';
- echo '<br /><a href="gUsers.php" target="_blank">', $strGUsers, ' </a>';
- echo '<br /><a href="fUsers.php" target="_blank">', $strFUsers, ' </a>';
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement