gaffling / PHP-Grab-Favicon

🖼 Saves the favicon of the given URL and returns the image path.
http://suchmaschine.biz
MIT License
26 stars 6 forks source link

Command Line Switches and New Features #6

Closed LeeThompson closed 1 year ago

LeeThompson commented 1 year ago

Overview

Please note, other than some spot testing, this has not been tested much.

By it's design, it appears that the original use case had this run as a web script whereas I am using it as a command line tool so it should be tested for the various environments/use cases.

Changes

Command Line Switches:

Other Features:

Other Items:

Usage Examples

C:\php\php.exe get-fav.php --list=sites.txt --path=icons --save --debug C:\php\php.exe get-fav.php --list=http://www.microsoft.com,http://www.google.com --path=icons --save

Notes

I've been testing pretty heavily, I've made some changes but nothing major, adding some more debug entries (mostly for me lol).

There is an issue where sometimes it takes a really long time for a download to fail but I think it's beyond the script and sometimes CURL is not honoring timeouts.

Changes since this PR

  1. Added --curl-verbose and --user-agent command line options (--user-agent allows you to set cURL's User Agent)
  2. Added timeout support for curl (default is still 60)
  3. If in console mode it won't use set_time_limit
  4. Added runtime total for CLI mode
LeeThompson commented 1 year ago

Going to redo this