Skip to content

🖼 Saves the favicon of the given URL and returns the image path, also grabs the title as well and has &format=json to return it as json..

License

Notifications You must be signed in to change notification settings

erievs/loogle-plus-site-metadata-grabber

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This Fork of PHP Favicon Grabber use a given url, save a copy (if wished) and returns the image path, and also gives the title.

This Isn't My Project This Is A Fork - My Changes


  1. Grabs Title
  2. &format=json gives you it in JSON
  3. Saves it it /metadata-storage/
  4. Grabs the biggest image, if that fails then we grab the favicon.

Fork Goals

Make it better for Loogle+, that's about it.

How it Works

  1. Check if the favicon already exists local or no save is wished, if so return path & filename
  2. Else load URL and try to match the favicon location with regex
  3. If we have a match the favicon link will be made absolute
  4. If we have no favicon we try to get one in domain root
  5. If there is still no favicon we randomly try google, faviconkit & favicongrabber API
  6. If favicon should be saved try to load the favicon URL
  7. If wished save the Favicon for the next time and return the path & filename

How to Use

$url = 'example.com';

$grap_favicon = array(
'URL' => $url,   // URL of the Page we like to get the Favicon from
'SAVE'=> true,   // Save Favicon copy local (true) or return only favicon url (false)
'DIR' => './',   // Local Dir the copy of the Favicon should be saved
'TRY' => true,   // Try to get the Favicon frome the page (true) or only use the APIs (false)
'DEV' => null,   // Give all Debug-Messages ('debug') or only make the work (null)
);

echo '<img src="'.grap_favicon($grap_favicon).'">';

Todo

Optional split the download dir into several sub-dirs (MD5 segment of filename e.g. /af/cd/example.com.png) if there are a lot of favicons.

Infos about Favicon

https://github.com/audreyr/favicon-cheat-sheet

Copyright 2019-2020 Igor Gaffling

About

🖼 Saves the favicon of the given URL and returns the image path, also grabs the title as well and has &format=json to return it as json..

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%