simpleuser
simpleuser

Reputation: 479

Twitter OAuth: users/search works but search/tweets does not

I want search for tweets in twitter. It is not working.

$parameters = array('q' => 'oauth');
$result = $connection->get('search', $parameters);

But when I do a user search it working perfectly.

$parameters = array('q' => 'oauth');
$result = $connection->get('users/search', $parameters);

I have also tried the below and that is also not working

$parameters = array('q' => 'oauth');
$result = $connection->get('search/tweets', $parameters);

What could be the reason?

Error message

stdClass Object
(
    [errors] => Array
        (
            [0] => stdClass Object
                (
                    [message] => Sorry, that page does not exist
                    [code] => 34
                )

        )

)

Upvotes: 3

Views: 3087

Answers (1)

jmic
jmic

Reputation: 897

You seem to be using the library TwitterOAuth by Abraham Williams.

I know this is an old question but I have just had the same problem as OP and it might keep happening to anyone else since apparently this library has not been updated for a while.

The problem seems to be that Twitter is no longer accepting requests via the version 1 of their API. You have to change the $host variable in the file twitteroauth.php as follows:

/* Set up the API root URL. */
//public $host = "https://api.twitter.com/1/";
public $host = "https://api.twitter.com/1.1/";

Upvotes: 7

Related Questions