header('Content-type: text/html; charset=utf8');
require 'twitteroauth.php';
/*
* Twitter
* @author Ahmet DAL
* Website : http://www.ahm3t.net
* Mail : ahmetdal06@gmail.com
* Twitter : @ahmetdal06
*/
class ahmet
{
public static $consumer;
public static $cs_secret;
public static $a_token;
public static $a_secret;
public static $myuser;
public static $anuser;
public static $takipci;
public static $baglan;
public static $limit;
function __construct()
{
ahmet::$consumer = 'xxxxxxxxxxxxxxxxxxxxx';
ahmet::$cs_secret = 'xxxxxxxxxxxxxxxxxxx';
ahmet::$a_token = 'xxxxxxxxxxxxxxxxxxxx';
ahmet::$a_secret = 'xxxxxxxxxxxxxxxxxxxx';
ahmet::$myuser = "xxxxxxxxxxxxxxxxxxxxx";
ahmet::$takipci= "xxxxxxxxxxxxxxxxxxxxxxxx";
ahmet::$baglan= $this->baglanti();
ahmet::$limit = "999";
}
public function baglanti() {
$twitter = new TwitterOAuth(ahmet::$consumer, ahmet::$cs_secret, ahmet::$a_token, ahmet::$a_secret);
return $twitter;
}
public function uyetakip($twitter)
{
$cp = $twitter->get('followers/ids', array('cursor' => -1, 'screen_name' => ahmet::$takipci, 'count' => ahmet::$limit));
$friends = $twitter->get('friends/ids', array('cursor' => -1, 'screen_name' => ahmet::$myuser, 'count' => ahmet::$limit));
if($cp->errors[0]->code == 88)
{
echo "Limit Yemişsin. "; // Limit Yiyince Gelecek Hata
}
else
{
foreach ($cp->ids as $i => $id)
{
if (empty($friends->ids) or !in_array($id, $friends->ids))
{
$ret = $twitter->post('friendships/create', array('user_id' => $id));
if($ret->errors)
{
if($ret->errors[0]->code == 161)
{
echo "Blok yemişin"; //
}
elseif ($ret->errors[0]->code == 160) {
echo "zaten takip ediyorsun"; // Takip Ediyorsun.
}
}
else
{
echo "".$i." kisi Takip edildi.
" . $id ;
}
}
}
}
}
public function timelinelike($twitter)
{
$cp = $twitter->get('statuses/home_timeline', array('cursor' => -1, 'screen_name' => ahmet::$myuser, 'count' => "50"));
foreach ( $cp as $tweet )
{
$id = $tweet->id;
$text = $tweet->text;
$created_at = date("Y-m-d H:i:s", strtotime($tweet->created_at));
$ret = $twitter->post('favorites/create', array('id' => $id));
echo "Durum Beğenildi. ->" . $id. $ret->text ."
"; // Durum Beğenildi
}
}
public function unfollow($twitter)
{
$cp = $twitter->get('followers/ids', array('cursor' => -1, 'screen_name' => ahmet::$myuser, 'count' => "5000"));
$friends = $twitter->get('friends/ids', array('cursor' => -1, 'screen_name' => ahmet::$myuser, 'count' => "5000"));
foreach ($friends->ids as $i => $id)
{
if (empty($friends->ids) or !in_array($id, $cp->ids))
{
$ret = $twitter->post('friendships/destroy', array('user_id' => $id));
}
}
}
}
?>