【问题标题】:Get twitter trends by woeid using tmhoauth使用 tmhoauth 通过 woeid 获取 Twitter 趋势
【发布时间】:2013-05-24 04:19:41
【问题描述】:

我正在使用 tmhoauth 库来构建一个小型 Twitter 应用程序演示。一切正常,例如检索推文、进行搜索等。但是当我尝试使用 woeid 检索热门话题时,我收到 404 - 此页面不存在错误。我尝试过不同的woeids'。

如果有人能指出我做错了什么,我将不胜感激。

这是我的代码。

    public function trends1(){
        require 'tmhOAuth.php';
        require 'tmhUtilities.php';

        $tmhOAuth = new tmhOAuth(array(
        'consumer_key' => $this->consumerkey,
        'consumer_secret' => $this->consumersecret,
        'user_token' => $this->accesstoken,
        'user_secret' => $this->accesstokensecret,
        'curl_ssl_verifypeer' => false
        ));

        $args = array('id' => '23424975');

        $code = $tmhOAuth->request("GET", $tmhOAuth->url("https://api.twitter.com/1.1/trends/place.json"), $args);
        print $code;
        $res = $tmhOAuth->response['response'];
        $trends = json_decode($res, true);
        return $trends;
    }

【问题讨论】:

    标签: php twitter


    【解决方案1】:

    尝试从 URL 中删除 https://api.twitter.com/。在我删除 URL 的那段之前,我也得到了 404,现在得到了 200 响应代码。

    【讨论】:

    • 完美运行!!!谢谢迈克......认为这永远不会得到回答:P 遗憾的是,我没有足够的声誉来投票给你的答案。再次感谢!
    • 也为我工作...他们已经在 lib 中预先定义了 host
    猜你喜欢
    • 2011-06-12
    • 2021-03-08
    • 1970-01-01
    • 2014-06-06
    • 2018-04-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-11
    • 1970-01-01
    相关资源
    最近更新 更多