1

i pulled the tweets from timeline but it also show the retweeted tweets which starts with "RT @" how can i use "retweeted" field to check the tweet. if it was retweeted i will not print it. how can i use it in the code you see :

$url = "https://api.twitter.com/1.1/statuses/home_timeline.json";
$requestMethod = "GET";

if (isset($_GET['user'])){
    $user = $_GET['user'];
} else {
    $user = "Parsi_Tweet";
}

if (isset($_GET['count'])) {
    $count = $_GET['count'];
} else {
    $retweeted_status = "";
}

$getfield = "?screen_name=$user&count=$count";
$twitter = new TwitterAPIExchange($settings);
$string = json_decode($twitter->setGetfield($getfield)
    ->buildOauth($url, $requestMethod)
    ->performRequest(),$assoc = TRUE
);

echo "TIME : ".$items['created_at']."<br />";
echo "TWEET : ". $items['text']."<br />";
echo "BY : ". $items['user']['name']."<br />";
Samuel Loog
  • 272
  • 1
  • 2
  • 18
Ali
  • 67
  • 1
  • 7
  • If it's a retweet, the tweet will contain a property named retweeted_status. To be complete, retweeted_status will not appear if the tweet is not a retweet. – Bhavin Dec 27 '16 at 11:42
  • i used "if (isset($_GET['retweeted_status']))..." and the outputs becomes just retweeted tweets! – Ali Dec 27 '16 at 11:45
  • i want to just pull Simple tweets, which my followers sends. not the tweets which they retweeted – Ali Dec 27 '16 at 11:46
  • If you found retweeted_status just remove them using else. So take only those tweets which are not retweeted_status. Just use else for it. Better solution is that you have to found parameter that take only tweets which you want. – Bhavin Dec 27 '16 at 11:49
  • good idea. but how can i remove them by else?! whats the "if" rule?! could you please help me by codes? (its PHP) – Ali Dec 27 '16 at 11:57

0 Answers0