Öncelikle composer kullanmanız gerek, istediğiniz bir klasöre konsoldan giriş yapıp
composer require abraham/twitteroauth
Komutunu çalıştırın, komposer twitter kütüphanesini eklediğinde bir index.php oluşturarak içerisine aşağıdaki kodları yapıştırın.
<?php
require "vendor/autoload.php";
use Abraham\TwitterOAuth\TwitterOAuth;
// ini_set('memory_limit', '-1'); // memory hatası alırsanız devreye alın.
$api_key = "CONSUMER_KEY";
$api_key_secret = "CONSUMER_KEY_SECRET";
$access_token = "OAUTH_TOKEN";
$access_token_secret = "OAUTH_TOKEN_SECRET";
$connection = new TwitterOAuth($api_key, $api_key_secret, $access_token, $access_token_secret);
$hesap = $connection->get("account/verify_credentials");
if(isset($_GET['q'])){
$q = $_GET['q'];
}else{
$q = $hesap->screen_name;
}
$parameters = array();
$method = "";
$friendlist = array();
$followerlist = array();
$cursor = -1;
while ($cursor != 0) {
$parameters = array('screen_name' => $q, 'cursor' => $cursor);
$method = "friends/list";
$response1 = $connection->get($method, $parameters);
$friendlist = array_merge($friendlist, $response1->users);
$cursor = $response1->next_cursor;
}
$cursor = -1;
while ($cursor != 0) {
$parameters = array('screen_name' => $q, 'cursor' => $cursor);
$method = "followers/list";
$response1 = $connection->get($method, $parameters);
$followerlist = array_merge($followerlist, $response1->users);
$cursor = $response1->next_cursor;
}
$friendScreenlist = array();
$followerScreenlist = array();
for ($i=0; $i < count($friendlist) ; $i++) {
array_push($friendScreenlist,$friendlist[$i]->screen_name);
}
for ($i=0; $i < count($followerlist) ; $i++) {
array_push($followerScreenlist,$followerlist[$i]->screen_name);
}
$result = array_diff($friendScreenlist, $followerScreenlist);
for ($i=0; $i <count($result) ; $i++) {
echo $result[$i]."<br>";
}
?>CONSUMER_KEY, CONSUMER_SECRET_KEY,OAUTH_TOKEN,OAUTH_TOKEN_SECRET yazan yerleri kendi uygulamanıza göre doldurun.
Sonrasında http://localhost/dosya/index.php?q=KULLANICIADI şeklinde sayfayı çalıştırarak istediğiniz herhangi bir hesabın geri takip etmeyenlerini görebilirsiniz.
Kullanırken php ayarlarından timeout kapatırsanız yüksek takipçiye sahip hesaplarda sıkıntı yaşamazsınız.
Yüksek takipçili while döngüsü kapatarak cursorları database bağlamak isteyebilirsiniz, uzun sürüyor