I want to reply only to tweet user post … but this code reply on tweet , retweet and reply of the user … what should i do to reply only to last tweet user post?
public function replyMessage($memberUsername, $message )
{
require_once('twitteroauth/OAuth.php');
require_once('twitteroauth/twitteroauth.php');
$consumer_key = "xxxxx";
$consumer_secret = "xxxxx";
$access_token = "xxxxxxxxx";
$access_token_secret = "xxxxxxxxxxxxxxx";
$connection = newTwitterOAuth($consumer_key,$consumer_secret,$access_token,$access_token_secret);
$statuses = $connection->get('statuses/user_timeline', array( 'count' => 1 , 'exclude_replies' => true, 'screen_name' => $memberUsername));
foreach($statuses as $status) { // records the id of the tweet just sent
$status_id = $status->id_str; // SHOULD return the id of the last tweet
var_dump($status);
var_dump($status_id);
$responce = $connection->post('statuses/update', array('in_reply_to_status_id'=> $status_id, 'status' => "@".$memberUsername." ".$message));
}
return $responce;