I am using this library for implementing twitter Oauth in my project, and codeigniter if that is relevant in this case.
I am trying to get a tweet based on the tweet id, but it's returning an error:
{"errors":[{"message":"Sorry, that page does not exist","code":34}]}
Here is the code I am 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 everything is right because I am using the plugin as well to get tweets based on a hashtag, and this is no problem at all.
The URl I am getting looks very similar to their docs url:
https://api.twitter.com/1.1/statuses/show.json?id=408541017676460000&....
I'm looking at this for a whole day now 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 actually exists? Altho I don't think that is the problem, I'd like to know for future reference
For those people stumbling on this:
I get the id from a previous request to twitter, and I found out you have to use the id_str
from the json data twitter returns, and not the normal id
. the string id and normal id are different. God may know why, but I'm just glad this got solved!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With