Posts

Showing posts with the label favicon

Download favicon from url returns broken .ico files

Image
Download favicon from url returns broken .ico files I tried to create a script to download favicons from a list of links: My file link_list.txt looks like the following: link_list.txt http://stackoverflow.com http://google.com facebook.com I am using the following library to check and download favicons: Github: FaviconDownloader My script currently looks like the following: <?php require_once 'vendor/autoload.php'; use VincepareFaviconDownloaderFaviconDownloader; $fh = fopen(dirname(__FILE__).DIRECTORY_SEPARATOR . 'link_list.txt','r'); while ($line = fgets($fh)) { //if the url has not http:// add it if(preg_match("@^http://@i",$line)) $line = preg_replace("@(http://)+@i",'http://',$line); else $line = 'http://'.$line; echo('URL: ' . $line."n"); $favicon = new FaviconDownloader($line); if (!$favicon->icoExists) { echo "No favicon for ".$favicon-...