Fetch Favicon

Get a Website favicon image.

/**
     * Get a Website favicon image.
     *
     * @param string $url        website url
     * @param array  $attributes Optional, additional key/value attributes to include in the IMG tag
     *
     * @return string containing complete image tag
     */

    function getFavicon($url)
    {
        $apiUrl = 'https://www.google.com/s2/favicons?domain=';

        if (strpos($url, 'http') !== false) {
            $url = str_replace(array('http://', 'https://'), '', $url);
        }
        return '<img src="' . $apiUrl . $url . '" />';
    }

Loading ...

Related Results :

  1. Fetch Favicon
Note :
  • Related Posts are generally User Blog posts.
  • or Other tutorials from other networks of w3clan.com.
  • Any registered user can create related posts based on search term tags.

About the Author