Return to Snippet

Revision: 30595
at August 18, 2010 01:28 by pixelsoul


Initial Code
<?php
// Grab the favicon of a domain using Google s2 Converter
// Put this in your php file and then call it like:
// http://yourdomain.com/file.php?url=somedomain.com

function getFavicon(){
	$linkurl = $_GET['url'];
	$linkurl = str_replace("http://",'',$linkurl); // remove protocol from the domain
	$imgurl = "http://www.google.com/s2/favicons?domain=" . $linkurl;
	echo '<img src="' . $imgurl . '" width="16" height="16" />';
}

getFavicon();
?>

Initial URL
http://snipplr.com/view/8120/google-favicon/

Initial Description
A simple function to grab the favicon of a domain using Google s2 Converter. I kept it simple just so it could be changed easily work in a number of different situations.

Initial Title
Get domain favicon through Google

Initial Tags


Initial Language
PHP