Aug
18
2010

Get domain favicon through Google

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

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.

<?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();
?>

About the Author: Urban Cetinski

Urban Cetinski :)

Leave a comment

Get Adobe Flash playerPlugin by wpburn.com wordpress themes