Replying to a tweet in php


#1

i am trying to reply to a tweet using php and i cannot get in_reply_to_status_id working. When i run the code, the tweet is sent to the user but it isnt send as a reply to the tweet i want. here is some of the code:

$twitteroauth->post(‘statuses/update’, array(‘status’ => $message, ‘in_reply_to_status_id’=>435718979743911937));

I have tried to do it many different ways but i keep getting the same result, can anybody help?


#2

Hello Darragh,

Are you using id_str as the value for the in_reply_to_status_id? We recommend using it as a string.

Actually, it seems the Tweet you are trying to reply to does not exist:

$ twurl /1.1/statuses/show.json?id=435718979743911937
{“errors”:[{“message”:“Sorry, that page does not exist”,“code”:34}]}

Please let us know if passing the id_str instead fixes your issue.


#3

Yes I am using the id_str as the value to pass through. i dont know why the tweet doesnt come up on that but when i pull all the data from my page you can see that the id is clearly there as id_str:

[16] => stdClass Object
(
[created_at] => Tue Feb 18 10:14:34 +0000 2014
[id] => 4.3571897974391E+17
[id_str] => 435718979743911937
[text] => Just had my first meeting with our client, alot of talking went on but id say I understood less than 1% of what was said :stuck_out_tongue:
[source] => Twitter for Android
[truncated] =>
[in_reply_to_status_id] =>
[in_reply_to_status_id_str] =>
[in_reply_to_user_id] =>
[in_reply_to_user_id_str] =>
[in_reply_to_screen_name] =>
[user] => stdClass Object


#4

i got it working and it was something so stupid all along that i was doing on the rest of the page that wasnt making it work. so the above code does work but i still dont understand why the id_str doesnt seem to get the tweet because it is a valid tweet


#5

Glad you were able to got it working. Do you have the URL of the Tweet you are trying to reply to, or is this Tweet protected maybe? Let us know if we can help further.