How to retrieve a specified number of recent tweets for a particular user passing username and number of tweets as parameter using php script?

Hi All

I have code to retrieve tweets but producing error
this is my code

$result=file_get_contents('https://api.twitter.com/1.1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=php_net&count=10');
$tweets=json_decode($result);
print_r($tweets);
vishnu kalakotaAsked:
Who is Participating?
 
Ray PaseurCommented:
The code is not producing an "error" -- it's simply getting you to an endpoint of the API that returns a JSON object telling you that your request cannot be serviced.  The response code and message tell you why.  Generally speaking, you probably want to start your learning at https://dev.twitter.com/overview/documentation.  

In the instant case, you're going to need authentication, and probably will find OAuth to be the most flexible approach.
https://dev.twitter.com/oauth/overview/authentication-by-api-family
0
 
vishnu kalakotaAuthor Commented:
Thank you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.