3

我想在推特上搜索推文。它不工作。

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

但是当我进行用户搜索时,它工作得很好。

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

我也尝试了以下方法,但这也不起作用

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

可能是什么原因?

错误信息

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

        )

)
4

1 回答 1

7

您似乎正在使用 Abraham Williams 的库TwitterOAuth

我知道这是一个老问题,但我刚刚遇到了与 OP 相同的问题,并且它可能会继续发生在其他任何人身上,因为显然这个库已经有一段时间没有更新了。

问题似乎是 Twitter 不再通过其 API 版本 1 接受请求。您必须按如下方式更改$host文件中的变量:twitteroauth.php

/* Set up the API root URL. */
//public $host = "https://api.twitter.com/1/";
public $host = "https://api.twitter.com/1.1/";
于 2012-12-18T20:56:37.587 回答