Hi,
sorry I m a newbee here. I have a php script that can track tweet based on one account send back a tweet if a certain keyword is part of the message.
But this script sends a tweet to the original sender and what I would like to do is to REPLY to the original tweet…
So I ve added the in_reply_to_status_id property with the original tweet id but that doesn’t seem to be what is expected…
Here is the code I m using, can you tell me what’s wrong? Thanks !!
$tweets = json_decode($response);
$i = 0;
$txt = '';
$txtid = '';
foreach($tweets as $tweet)
{
//print_r($tweet);
if ($i == 0){
$cmp = $tweet->text;
if (strpos($cmp,"showroom") !== false){
//print_r($tweet);
//print_r($tweet->id);
$txt = "@".$tweet->user->screen_name." You can find all our showroom here: https://www.someurlofmine.com";
$txtid = '$tweet->id';
}
}
$i++;
}
if ($txt != '') {
$url = "https://api.twitter.com/1.1/statuses/update.json";
$requestMethod = 'POST';
$postfields = array(
'status' => $txt,
'in_reply_to_status_id' => $txtid
);
$twitter = new TwitterAPIExchange($settings);
$response = $twitter->buildOauth($url, $requestMethod)
->setPostfields($postfields)
->performRequest();
}
sleep(15);