0

I'm trying to get the user timeline for my twitter timeline, and it keeps giving me the return "page not found". The code is below:

require_once("twitteroauth/autoload.php");
use Abraham\TwitterOAuth\TwitterOAuth;

$connection = new TwitterOAuth($this->consumer_key, $this->consumer_secret, $this->oauth_access_token, $this->oauth_access_token_secret);
$data = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$this->username."&count=".$this->limit); 
return $data; 

Can't figure out what I'm doing wrong, any help is appreciated. Thanks!

thatDubstepSound
  • 337
  • 5
  • 18

1 Answers1

0

I just tried it, and initially ran into the same issue. Reading This Documentation, it appears that there is a different format for making API requests with the TwitterOAuth library.

The example in this post was helpful as well: How to get the 3,200 tweets (Twitter API 1.1)

Try this, it worked for me:

require_once("twitteroauth/autoload.php");
use Abraham\TwitterOAuth\TwitterOAuth;

$connection = new TwitterOAuth($this->consumer_key, $this->consumer_secret, $this->oauth_access_token, $this->oauth_access_token_secret);


$data = $connection->get("statuses/user_timeline", array('count' => $this->limit, 'exclude_replies' => true, 'screen_name' => $this->username));

return $data; 
Community
  • 1
  • 1
Daniel Nugent
  • 43,104
  • 15
  • 109
  • 137