2013-05-16 68 views
2

我使用tmhoauth库来构建一个小型的twitter应用程序演示。一切工作正常,如检索鸣叫,进行搜索等。但是,当我尝试使用woeid检索热门话题时,我得到一个404 - 此页面不存在错误。我曾尝试过不同的世界。使用tmhoauth获取twitter趋势woooooo

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

这是我的代码。

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

回答

3

尝试从URL中删除https://api.twitter.com/。我得到了一个404,直到我删除了这个网段,现在我得到了200个响应代码。

+0

完美的作品!感谢迈克......以为这永远不会被回答:P可悲的是,我没有足够的声望来投票回答你的答案。再次感谢 ! – user2115154

+0

也为我工作......他们已经在lib中预先定义了** host **。 – VKGS