コード例 #1
0
ファイル: Reader.php プロジェクト: shylar/picoFeed
 /**
  * Download a feed
  *
  * @access public
  * @param  string  $url            Feed content
  * @param  string  $last_modified  Last modified HTTP header
  * @param  string  $etag           Etag HTTP header
  * @return \PicoFeed\Client
  */
 public function download($url, $last_modified = '', $etag = '')
 {
     if (strpos($url, 'http') !== 0) {
         $url = 'http://' . $url;
     }
     $client = Client::getInstance();
     $client->setTimeout($this->config->getClientTimeout())->setUserAgent($this->config->getClientUserAgent())->setMaxRedirections($this->config->getMaxRedirections())->setMaxBodySize($this->config->getMaxBodySize())->setProxyHostname($this->config->getProxyHostname())->setProxyPort($this->config->getProxyPort())->setProxyUsername($this->config->getProxyUsername())->setProxyPassword($this->config->getProxyPassword())->setLastModified($last_modified)->setEtag($etag);
     if ($client->execute($url)) {
         $this->content = $client->getContent();
         $this->url = $client->getUrl();
         $this->encoding = $client->getEncoding();
     }
     return $client;
 }