GoneInsane
GoneInsane

Reputation: 13

Twitter OAuth Send Status Update Not Working

Why is this code not working? I need it to get the latest tweets for the search tag dog and then submit a status update with a reply to the user who sent the tweet with the search tag dog. I am using Abraham's twitteroauth found here: https://github.com/abraham/twitteroauth/downloads

   <?php
require_once('twitteroauth.php');

define('CONSUMER_KEY', 'CONSUMERKEYHERE');
define('CONSUMER_SECRET', 'SECRET HERE');
define('ACCESS_TOKEN', 'TOKENHERE');
define('ACCESS_TOKEN_SECRET', 'TOKENSECRETHERE');

$twitter = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);
$twitter->host = "http://search.twitter.com/";
$search = $twitter->get('search', array('q' => 'dog', 'rpp' => 5));

$twitter->host = "https://api.twitter.com/1/";
foreach($search->results as $tweet) {
    $status = '@$tweet->from_user Here my reply would go';
    $twitter->post('statuses/update', array('status' => $status));
}
?>

I have entered my consumer key, secret and tokens but removed them here.

Thanks!

Upvotes: 0

Views: 1028

Answers (1)

Chris Carson
Chris Carson

Reputation: 1845

The Twitter search API is separate from the REST API and doesn't require authentication. So using OAuth probably won't work.

Upvotes: 1

Related Questions