Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grabbing tweets using PHP [closed]

I am trying to grab tweets from Twitter. What I have is a list of users which I would like to grab their tweets from and store them in my database. I would like to know if I am going to use Twitter API or is there any simple code for me to achieve this.

According to https://dev.twitter.com/docs/twitter-libraries#php there are five libraries in PHP. I would like to know which one is good for me to use?

Thanks everyone.

like image 491
user1311794 Avatar asked Jul 30 '26 07:07

user1311794


1 Answers

With Twitter it couldn't be simpler. Just file_get_contents() this URL: http://twitter.com/statuses/user_timeline.json?screen_name=USERNAME&count=10 and you'll get a JSON with USERNAME's 10 latest tweets.

$tweets = json_decode(file_get_contents('http://twitter.com/statuses/user_timeline.json?screen_name=USERNAME&count=10'));

var_dump($tweets);
like image 107
powerbuoy Avatar answered Aug 02 '26 00:08

powerbuoy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!