Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a website's favicon with PHP?

Tags:

I want to get, requested website's favicon with PHP. I have been recommended using Google's favicon service but it is not functional. I want to do something on my own but don't know regex usage.

I found a class on Google that works on most cases but it has unacceptable error rate. You can have a look here: http://www.controlstyle.com/articles/programming/text/php-favicon/

Can somebody please help me about getting favicon using regex, please?

like image 950
aiternal Avatar asked Apr 18 '11 10:04

aiternal


People also ask

How do I get a favicon from a website?

Right-click on the website and click the "View page info" option from the list. It will open up a dialog and click on the "Media" tab. In that tab you will see all the images including favicon.

How do you insert a favicon?

To add a favicon to your website, either save your favicon image to the root directory of your webserver, or create a folder in the root directory called images, and save your favicon image in this folder. A common name for a favicon image is "favicon.ico".

Which HTML tag is used for favicon?

A favicon is added in the <head> tag of a web page. The <head> tag is where all the so-called “meta” information goes. Meta information is details about the web page itself, such as the title of the page.


1 Answers

Use the S2 service provided by google. It is as simple as this

http://www.google.com/s2/favicons?domain=www.yourdomain.com

Scraping this would be much easier, that trying to do it yourself.

like image 57
Starx Avatar answered Oct 07 '22 10:10

Starx