Example #1
0
 public static function setCache($cache)
 {
     self::$_cache = $cache;
 }
Example #2
0
 protected function _requestBasic($url, $host, $opt = array(), $method = 'GET', $auth = true, $multipart = false, $type = ".xml")
 {
     $req = new Tuitter_Http_Request("{$url}{$type}", $host);
     if ($auth) {
         $req->setBasicAuth($this->_user, $this->_pass);
     }
     $headers = array();
     if ($this->_client_name) {
         $headers['X-Twitter-Client'] = $this->_client_name;
     }
     if ($this->_client_version) {
         $headers['X-Twitter-Version'] = $this->_client_version;
     }
     if ($this->_client_url) {
         $headers['X-Twitter-URL'] = $this->_client_url;
     }
     $req->setMultipart($multipart);
     $req->setHeaders($headers);
     $req->setPrms($opt);
     $res = Tuitter_Http::send($req, $method);
     $retry = $this->_retry;
     while ($res->getStatus() >= 500 and $retry--) {
         sleep($this->_retryInterval);
         $res = Tuitter_Http::send($req, $method);
     }
     if ($res->getStatus() >= 400) {
         throw new Exception($this->_getErrMsgByHttp($res));
     }
     return $res->getBody();
 }