user2115154
user2115154

Reputation: 213

Get twitter trends by woeid using tmhoauth

I am using tmhoauth library to build a small twitter app demo. Everything works fine like retrieving tweets, making searches etc. But when I try to retrieve trending topics using woeid, I get a 404 - This page does not exist error. I have tried different woeids'.

I will be grateful if someone could point what I am doing wrong.

here is my code.

    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;
    }

Upvotes: 2

Views: 1379

Answers (1)

downtomike
downtomike

Reputation: 94

Try removing https://api.twitter.com/ from the URL. I was getting a 404 as well until I removed that segment of the URL and am now getting a 200 response code.

Upvotes: 3

Related Questions