PHP code example of vincepare / favicon-downloader

1. Go to this page and download the library: Download vincepare/favicon-downloader library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vincepare / favicon-downloader example snippets



use Vincepare\FaviconDownloader\FaviconDownloader;

// Find & download favicon
$favicon = new FaviconDownloader('http://stackoverflow.com/questions/19503326/bug-with-chrome-tabs-create-in-a-loop');

if (!$favicon->icoExists) {
    echo "No favicon for ".$favicon->url;
    die(1);
}

echo "Favicon found : ".$favicon->icoUrl."\n";

// Saving favicon to file
$filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'favicon-'.time().'.'.$favicon->icoType;
file_put_contents($filename, $favicon->icoData);
echo "Saved to ".$filename."\n\n";

echo "Details :\n";
$favicon->debug();