コード例 #1
0
ファイル: proxy.php プロジェクト: mrjovanovic/miniflux
function download($url)
{
    if ((bool) Config\get('debug_mode')) {
        Logger::enable();
    }
    $client = Client::getInstance();
    $client->setUserAgent(Config\HTTP_USER_AGENT);
    $client->enablePassthroughMode();
    $client->execute($url);
    Config\write_debug();
}
コード例 #2
0
ファイル: service.php プロジェクト: cs-team/miniflux
function api_call($url)
{
    try {
        $client = Client::getInstance();
        $client->setUserAgent(Config\HTTP_USER_AGENT);
        $client->execute($url);
        return $client;
    } catch (ClientException $e) {
        return false;
    }
}
コード例 #3
0
ファイル: Favicon.php プロジェクト: indigo423/blog.no42.org
 /**
  * Download and check if a resource exists.
  *
  * @param string $url URL
  *
  * @return \PicoFeed\Client Client instance
  */
 public function download($url)
 {
     $client = Client::getInstance();
     $client->setConfig($this->config);
     Logger::setMessage(get_called_class() . ' Download => ' . $url);
     try {
         $client->execute($url);
     } catch (ClientException $e) {
         Logger::setMessage(get_called_class() . ' Download Failed => ' . $e->getMessage());
     }
     return $client;
 }
コード例 #4
0
ファイル: ClientTest.php プロジェクト: nrbrt/news
 /**
  * @group online
  */
 public function testContentType()
 {
     $client = Client::getInstance();
     $client->setUrl('http://miniflux.net/assets/img/favicon.png');
     $client->execute();
     $this->assertEquals('image/png', $client->getContentType());
     $client = Client::getInstance();
     $client->setUrl('http://miniflux.net/');
     $client->execute();
     $this->assertEquals('text/html; charset=utf-8', $client->getContentType());
 }
コード例 #5
0
ファイル: Reader.php プロジェクト: mrjovanovic/miniflux
 /**
  * Download a feed (no discovery)
  *
  * @access public
  * @param  string            $url              Feed url
  * @param  string            $last_modified    Last modified HTTP header
  * @param  string            $etag             Etag HTTP header
  * @return \PicoFeed\Client\Client
  */
 public function download($url, $last_modified = '', $etag = '')
 {
     $url = $this->prependScheme($url);
     return Client::getInstance()->setConfig($this->config)->setLastModified($last_modified)->setEtag($etag)->execute($url);
 }
コード例 #6
0
ファイル: Scraper.php プロジェクト: fguillot/picofeed
 /**
  * Download the HTML content.
  *
  * @return bool
  */
 public function download()
 {
     if (!empty($this->url)) {
         // Clear everything
         $this->html = '';
         $this->content = '';
         $this->encoding = '';
         try {
             $client = Client::getInstance();
             $client->setConfig($this->config);
             $client->setTimeout($this->config->getGrabberTimeout());
             $client->setUserAgent($this->config->getGrabberUserAgent());
             $client->execute($this->url);
             $this->url = $client->getUrl();
             $this->html = $client->getContent();
             $this->encoding = $client->getEncoding();
             return true;
         } catch (ClientException $e) {
             Logger::setMessage(get_called_class() . ': ' . $e->getMessage());
         }
     }
     return false;
 }
コード例 #7
0
ファイル: Grabber.php プロジェクト: mrjovanovic/miniflux
 /**
  * Download the HTML content
  *
  * @access public
  * @return HTML content
  */
 public function download()
 {
     if (!$this->skip_processing && $this->url != '') {
         try {
             $client = Client::getInstance();
             $client->setConfig($this->config);
             $client->execute($this->url);
             $this->url = $client->getUrl();
             $this->html = $client->getContent();
             $this->encoding = $client->getEncoding();
         } catch (ClientException $e) {
             Logger::setMessage(get_called_class() . ': ' . $e->getMessage());
         }
     }
     return $this->html;
 }
コード例 #8
0
 /**
  * Returns a new instance of an PicoFeed Http client
  * @return \PicoFeed\Client instance
  */
 public function build()
 {
     $client = Client::getInstance();
     $client->setConfig($this->config);
     return $client;
 }