I want to reply only to tweet user post

php
api

#1

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;

#2

GET statuses/user_timeline supports a number of parameters to control what types of statuses are returned. Actually it looks like you are already using exclude_replies, there is an additional one include_rts that when set to false will not return retweets.


#3

thank you Abraham , you are the best :heart_eyes: :smile: