Twitter Oauth Statuses / show in codeigniter returns error

I use this library to implement twitter Oauth in my project, and codeigniter if that matters in this case.

I am trying to get a tweet based on the tweet id, but it returns an error:

{"errors":[{"message":"Sorry, that page does not exist","code":34}]} 

Here is the code I'm using:

 public function gettweetbyid() { $this->config->load('twitter'); $consumer = $this->config->item('twitter_consumer_token'); $consumer_secret = $this->config->item('twitter_consumer_secret'); $access_token = $this->config->item('twitter_access_token'); $access_token_secret = $this->config->item('twitter_access_secret'); $connection = $this->twitteroauth->create($consumer, $consumer_secret, $access_token, $access_token_secret); $content = $connection->get('account/verify_credentials'); $data = array( 'id' => $this->input->get('id') ); $tweets = $this->twitteroauth->get('statuses/show', $data); echo json_encode($tweets); } 

I know that everything is correct, because I use the plugin to get hashtag-based tweets, and that is not a problem.

URl I get looks very similar to the URL of my docs:

 https://api.twitter.com/1.1/statuses/show.json?id=408541017676460000&.... 

I look at it all day and my time is running out ...

Any help would be appreciated!

Edit: Also, is there any way on twitter, I can check if the ID really exists? Altho I do not think this is a problem, I would like to know for future reference

+6
source share
1 answer

For those who stumbled upon this:

I get the identifier from a previous twitter request, and I found out that you should use id_str from the json data twitter data, not a regular id . row id and regular id are different. God may know why, but I'm just glad it was decided!

+3
source

Source: https://habr.com/ru/post/959396/


All Articles