diff options
Diffstat (limited to 'vendor/fguillot/picofeed/docs/favicon.markdown')
-rw-r--r-- | vendor/fguillot/picofeed/docs/favicon.markdown | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/vendor/fguillot/picofeed/docs/favicon.markdown b/vendor/fguillot/picofeed/docs/favicon.markdown new file mode 100644 index 000000000..92ae11928 --- /dev/null +++ b/vendor/fguillot/picofeed/docs/favicon.markdown @@ -0,0 +1,56 @@ +Favicon fetcher +=============== + +Find and download the favicon +----------------------------- + +```php + +use PicoFeed\Favicon; + +$favicon = new Favicon; + +// The icon link is https://bits.wikimedia.org/favicon/wikipedia.ico +$icon_link = $favicon->find('https://en.wikipedia.org/'); +$icon_content = $favicon->getContent(); + +``` + +PicoFeed will try first to find the favicon from the meta tags and fallback to the `favicon.ico` located in the website's root if nothing is found. + +- `Favicon::find()` returns the favicon absolute url or an empty string if nothing is found. +- `Favicon::getContent()` returns the favicon file content (binary content) + +When the HTML page is parsed, relative links and protocol relative links are converted to absolute url. + +Check if a favicon link exists +------------------------------ + +```php + +use PicoFeed\Favicon; + +$favicon = new Favicon; + +// Return true if the file exists +var_dump($favicon->exists('http://php.net/favicon.ico')); + +``` + +Use personalized HTTP settings +------------------------------ + +Like other classes, the Favicon class support the Config object as constructor argument: + +```php + +use PicoFeed\Config; +use PicoFeed\Favicon; + +$config = new Config; +$config->setClientUserAgent('My RSS Reader'); + +$favicon = new Favicon($config); +$favicon->find('https://github.com'); + +```
\ No newline at end of file |