-
Notifications
You must be signed in to change notification settings - Fork 800
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add removeFollower method * Add removeFollower Example
- Loading branch information
1 parent
9bdde66
commit e6d9997
Showing
3 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
use InstagramScraper\Instagram; | ||
use Phpfastcache\Helper\Psr16Adapter; | ||
|
||
require __DIR__ . '/../vendor/autoload.php'; | ||
|
||
$username = 'username'; | ||
$password = 'password'; | ||
|
||
$instagram = Instagram::withCredentials( | ||
new \GuzzleHttp\Client(), | ||
$username, | ||
$password, | ||
new Psr16Adapter('Files') | ||
); | ||
|
||
$instagram->login(); | ||
|
||
$instagram->saveSession(); | ||
|
||
|
||
$accountId = $instagram->getAccountInfo($username)->getId(); | ||
|
||
$followers = $instagram->getFollowers($accountId); | ||
|
||
if (isset($followers[0])) { | ||
|
||
$lastFollower = $followers[0]; | ||
$lastFollowerId = $lastFollower['id']; | ||
$lastFollowerUsername = $lastFollower['username']; | ||
|
||
$instagram->removeFollower($lastFollowerId); | ||
|
||
print_r("{$lastFollowerUsername} Removed."); | ||
} else { | ||
|
||
print_r('Follower Not Found.'); | ||
} |
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
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