Example #1
0
    /**
     * Get the current twitter trends.  Currnetly only supports json as the return.
     *
     * @throws Zend_Http_Client_Exception
     * @return array
     */
    public function trends()
    {
        $response     = $this->restGet('/trends.json');

        return Json::decode($response->getBody());
    }
Example #2
0
 /**
  * Performs a Twitter search query.
  *
  * @throws Zend_Http_Client_Exception
  */
 public function search($query, array $params = array())
 {
     $_query = array();
     $_query['q'] = $query;
     foreach ($params as $key => $param) {
         switch ($key) {
             case 'geocode':
             case 'lang':
             case 'since_id':
                 $_query[$key] = $param;
                 break;
             case 'rpp':
                 $_query[$key] = intval($param) > 100 ? 100 : intval($param);
                 break;
             case 'page':
                 $_query[$key] = intval($param);
                 break;
             case 'show_user':
                 $_query[$key] = 'true';
         }
     }
     $response = $this->restGet('/search.' . $this->_responseType, $_query);
     switch ($this->_responseType) {
         case 'json':
             return Json::decode($response->getBody());
             break;
         case 'atom':
             return Feed\Reader::importString($response->getBody());
             break;
     }
     return;
 }