Esempio n. 1
0
 /**
  * Fetch a new feed.
  */
 private function fetch()
 {
     if (!$this->url) {
         return false;
     }
     $this->posted = array();
     $this->skipped = array();
     $this->duplicate = array();
     $this->lastReturned = 0;
     $this->time = '';
     $this->cachedTime = '';
     global $idfeedversion;
     $http = new http_request($this->getFullURL());
     $http->set_useragent("EDK IDFeedfetcher " . $idfeedversion);
     $http->set_timeout(300);
     //accept gzip encoding
     $http->set_header('Accept-Encoding: gzip');
     if (strpos($http->get_header(), 'Content-Encoding: gzip') !== false) {
         $this->xml = gzdecode($http->get_content());
     } else {
         $this->xml = $http->get_content();
     }
     if ($http->get_http_code() != 200) {
         trigger_error("HTTP error " . $http->get_http_code() . " while fetching feed from " . $this->url . $options . ".", E_USER_WARNING);
         return false;
     }
     if ($this->xml) {
         return true;
     } else {
         return false;
     }
 }