Giter Site home page Giter Site logo

favicon's People

Contributors

alkarex avatar arthurhoaro avatar cetcondor avatar christophwurst avatar ilpianista avatar kitbs avatar shiflett avatar smillerdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

favicon's Issues

get_headers bug

get_headers may return arrays.

Tested on PHP 7.0.15-1ubuntu4 and on http://phpfiddle.org

<pre>
<?php
$url = 'http://sciencesetavenir.nouvelobs.com/';
$headers = get_headers($url, 1);
print_r($headers);
?>
</pre>

Returns

Array
(
    [0] => HTTP/1.1 301 Moved Permanently
    [Date] => Array
        (
            [0] => Sat, 22 Apr 2017 22:41:34 GMT
            [1] => Sat, 22 Apr 2017 19:37:31 GMT
            [2] => Sat, 22 Apr 2017 22:41:34 GMT
            [3] => Sat, 22 Apr 2017 19:37:31 GMT
            [4] => Sat, 22 Apr 2017 22:41:34 GMT
            [5] => Sat, 22 Apr 2017 22:41:35 GMT
            [6] => Sat, 22 Apr 2017 22:41:35 GMT
            [7] => Sat, 22 Apr 2017 22:41:35 GMT
            [8] => Sat, 22 Apr 2017 22:41:35 GMT
            [9] => Sat, 22 Apr 2017 22:41:35 GMT
            [10] => Sat, 22 Apr 2017 19:37:31 GMT
            [11] => Sat, 22 Apr 2017 19:37:31 GMT
            [12] => Sat, 22 Apr 2017 22:41:35 GMT
            [13] => Sat, 22 Apr 2017 19:37:31 GMT
            [14] => Sat, 22 Apr 2017 22:41:36 GMT
            [15] => Sat, 22 Apr 2017 19:37:31 GMT
            [16] => Sat, 22 Apr 2017 22:41:36 GMT
            [17] => Sat, 22 Apr 2017 19:37:31 GMT
            [18] => Sat, 22 Apr 2017 22:41:36 GMT
            [19] => Sat, 22 Apr 2017 19:37:31 GMT
        )

    [Server] => Array
        (
            [0] => Varnish
            [1] => ECS (lhr/473F)
            [2] => ECS (lhr/476A)
            [3] => ECS (lhr/4764)
            [4] => ECS (lhr/47F0)
            [5] => ECS (lhr/47F2)
            [6] => ECS (lhr/4745)
            [7] => ECS (lhr/4745)
            [8] => ECS (lhr/4745)
            [9] => ECS (lhr/476A)
            [10] => ECS (lhr/4764)
            [11] => ECS (lhr/D245)
            [12] => ECS (lhr/476A)
            [13] => ECS (lhr/D245)
            [14] => ECS (lhr/47F2)
            [15] => ECS (lhr/47F1)
            [16] => ECS (lhr/47F2)
            [17] => ECS (lhr/47F1)
            [18] => ECS (lhr/47F2)
            [19] => ECS (lhr/473F)
        )

    [X-Varnish] => 937281833
    [Location] => Array
        (
            [0] => http://www.sciencesetavenir.fr/
            [1] => https://www.sciencesetavenir.fr/
            [2] => https://www.sciencesetavenir.fr/
            [3] => https://www.sciencesetavenir.fr/
            [4] => https://www.sciencesetavenir.fr/
            [5] => https://www.sciencesetavenir.fr/
            [6] => https://www.sciencesetavenir.fr/
            [7] => https://www.sciencesetavenir.fr/
            [8] => https://www.sciencesetavenir.fr/
            [9] => https://www.sciencesetavenir.fr/
            [10] => https://www.sciencesetavenir.fr/
            [11] => https://www.sciencesetavenir.fr/
            [12] => https://www.sciencesetavenir.fr/
            [13] => https://www.sciencesetavenir.fr/
            [14] => https://www.sciencesetavenir.fr/
            [15] => https://www.sciencesetavenir.fr/
            [16] => https://www.sciencesetavenir.fr/
            [17] => https://www.sciencesetavenir.fr/
            [18] => https://www.sciencesetavenir.fr/
            [19] => https://www.sciencesetavenir.fr/
        )

    [Content-Length] => Array
        (
            [0] => 0
            [1] => 66
            [2] => 66
            [3] => 66
            [4] => 66
            [5] => 66
            [6] => 66
            [7] => 66
            [8] => 66
            [9] => 66
            [10] => 66
            [11] => 66
            [12] => 66
            [13] => 66
            [14] => 66
            [15] => 66
            [16] => 66
            [17] => 66
            [18] => 66
            [19] => 66
        )

    [Connection] => Array
        (
            [0] => close
            [1] => close
            [2] => close
            [3] => close
            [4] => close
            [5] => close
            [6] => close
            [7] => close
            [8] => close
            [9] => close
            [10] => close
            [11] => close
            [12] => close
            [13] => close
            [14] => close
            [15] => close
            [16] => close
            [17] => close
            [18] => close
            [19] => close
        )

    [1] => HTTP/1.0 301 Moved Permanently
    [Age] => Array
        (
            [0] => 11043
            [1] => 0
            [2] => 11043
            [3] => 0
            [4] => 0
            [5] => 0
            [6] => 0
            [7] => 0
            [8] => 0
            [9] => 11044
            [10] => 11044
            [11] => 0
            [12] => 11044
            [13] => 0
            [14] => 11045
            [15] => 0
            [16] => 11045
            [17] => 0
            [18] => 11045
        )

    [Cache-Control] => Array
        (
            [0] => no-cache
            [1] => no-cache
            [2] => no-cache
            [3] => no-cache
            [4] => no-cache
            [5] => no-cache
            [6] => no-cache
            [7] => no-cache
            [8] => no-cache
            [9] => no-cache
            [10] => no-cache
            [11] => no-cache
            [12] => no-cache
            [13] => no-cache
            [14] => no-cache
            [15] => no-cache
            [16] => no-cache
            [17] => no-cache
            [18] => no-cache
        )

    [Content-Type] => Array
        (
            [0] => text/plain; charset=utf-8
            [1] => text/plain; charset=utf-8
            [2] => text/plain; charset=utf-8
            [3] => text/plain; charset=utf-8
            [4] => text/plain; charset=utf-8
            [5] => text/plain; charset=utf-8
            [6] => text/plain; charset=utf-8
            [7] => text/plain; charset=utf-8
            [8] => text/plain; charset=utf-8
            [9] => text/plain; charset=utf-8
            [10] => text/plain; charset=utf-8
            [11] => text/plain; charset=utf-8
            [12] => text/plain; charset=utf-8
            [13] => text/plain; charset=utf-8
            [14] => text/plain; charset=utf-8
            [15] => text/plain; charset=utf-8
            [16] => text/plain; charset=utf-8
            [17] => text/plain; charset=utf-8
            [18] => text/plain; charset=utf-8
        )

    [Vary] => Array
        (
            [0] => Accept, Accept-Encoding, X-Forwarded-Proto, X-HTTPS-TEST
            [1] => Accept, Accept-Encoding, X-Forwarded-Proto, X-HTTPS-TEST
            [2] => Accept, Accept-Encoding, X-Forwarded-Proto, X-HTTPS-TEST
            [3] => Accept, Accept-Encoding, X-Forwarded-Proto, X-HTTPS-TEST
            [4] => Accept, Accept-Encoding, X-Forwarded-Proto, X-HTTPS-TEST
            [5] => Accept, Accept-Encoding, X-Forwarded-Proto, X-HTTPS-TEST
            [6] => Accept, Accept-Encoding, X-Forwarded-Proto, X-HTTPS-TEST
            [7] => Accept, Accept-Encoding, X-Forwarded-Proto, X-HTTPS-TEST
            [8] => Accept, Accept-Encoding, X-Forwarded-Proto, X-HTTPS-TEST
            [9] => Accept, Accept-Encoding, X-Forwarded-Proto, X-HTTPS-TEST
            [10] => Accept, Accept-Encoding, X-Forwarded-Proto, X-HTTPS-TEST
            [11] => Accept, Accept-Encoding, X-Forwarded-Proto, X-HTTPS-TEST
            [12] => Accept, Accept-Encoding, X-Forwarded-Proto, X-HTTPS-TEST
            [13] => Accept, Accept-Encoding, X-Forwarded-Proto, X-HTTPS-TEST
            [14] => Accept, Accept-Encoding, X-Forwarded-Proto, X-HTTPS-TEST
            [15] => Accept, Accept-Encoding, X-Forwarded-Proto, X-HTTPS-TEST
            [16] => Accept, Accept-Encoding, X-Forwarded-Proto, X-HTTPS-TEST
            [17] => Accept, Accept-Encoding, X-Forwarded-Proto, X-HTTPS-TEST
            [18] => Accept, Accept-Encoding, X-Forwarded-Proto, X-HTTPS-TEST
        )

    [X-CFCache1] => Array
        (
            [0] => 827003475
            [1] => 820505862
            [2] => 827555875
            [3] => 826388469
            [4] => 824250722
            [5] => 826294052
            [6] => 797522042
            [7] => 826294058
            [8] => 825449419
            [9] => 823638704
            [10] => 826294065
            [11] => 827523355
        )

    [X-CFCache2] => Array
        (
            [0] => 1024846869 1032890995
            [1] => 1040525133 1032890995
            [2] => 1039715985 1032890995
            [3] => 1041109099 1032890995
            [4] => 1040590918 1032890995
            [5] => 1037062349 1032890995
            [6] => 1041531574 1032890995
            [7] => 1038772353 1032890995
        )

    [X-Croise-Owner] => Array
        (
            [0] => varnish2
            [1] => varnish1
            [2] => varnish2
            [3] => varnish1
            [4] => varnish1
            [5] => varnish1
            [6] => varnish1
            [7] => varnish1
            [8] => varnish1
            [9] => varnish2
            [10] => varnish2
            [11] => varnish1
            [12] => varnish2
            [13] => varnish1
            [14] => varnish2
            [15] => varnish1
            [16] => varnish2
            [17] => varnish1
            [18] => varnish2
        )

    [2] => HTTP/1.0 301 Moved Permanently
    [3] => HTTP/1.0 301 Moved Permanently
    [4] => HTTP/1.0 301 Moved Permanently
    [5] => HTTP/1.0 301 Moved Permanently
    [6] => HTTP/1.0 301 Moved Permanently
    [7] => HTTP/1.0 301 Moved Permanently
    [8] => HTTP/1.0 301 Moved Permanently
    [9] => HTTP/1.0 301 Moved Permanently
    [10] => HTTP/1.0 301 Moved Permanently
    [11] => HTTP/1.0 301 Moved Permanently
    [12] => HTTP/1.0 301 Moved Permanently
    [13] => HTTP/1.0 301 Moved Permanently
    [14] => HTTP/1.0 301 Moved Permanently
    [15] => HTTP/1.0 301 Moved Permanently
    [16] => HTTP/1.0 301 Moved Permanently
    [17] => HTTP/1.0 301 Moved Permanently
    [18] => HTTP/1.0 301 Moved Permanently
    [19] => HTTP/1.0 301 Moved Permanently
)

suspicious user-agent string

Not something important but FYI, I see this project in Cloudflare firewall logs that the requests are being blocked by "Browser integrity check".

Looking into the code, the user-agent string is indeed strange: pretending to be an old Firefox while not a browser in any way, having special characters \r\n in it. You might want to update it.

failed to open stream

When i try you script, apache scream me that :

PHP Warning: file_put_contents(/tmp.ico): failed to open stream: Permission denied in /srv/http/shaarli.local/vendor/arthurhoaro/favicon/src/Favicon/DataAccess.php on line 22
PHP Warning: finfo_file(/tmp.ico): failed to open stream: No such file or directory in /srv/http/shaarli.local/vendor/arthurhoaro/favicon/src/Favicon/Favicon.php on line 230
PHP Warning: file_put_contents(/tmp.ico): failed to open stream: Permission denied in /srv/http/shaarli.local/vendor/arthurhoaro/favicon/src/Favicon/DataAccess.php on line 22
PHP Warning: finfo_file(/tmp.ico): failed to open stream: No such file or directory in /srv/http/shaarli.local/vendor/arthurhoaro/favicon/src/Favicon/Favicon.php on line 230

My code is your example, just copy/paste, any idea.

Support for higher resolution favicons

Nowadays many website support high-resolution favicons (see: https://stackoverflow.com/a/22007642)

It would be very helpful if this library extracts the higher resolution favicon or returns a list of all available favicons that were found for a given url. I'm asking since this library is used in the nextcloud news reader and we would like to display the favicons using a higher resolution as the default 16x16 icons look blurry on modern displays.

Reference: nextcloud/news#633 (comment)

Save favicon in file

Can you add function for save copy of favicon in local file, better than hot linking. Maybe you think is not a job for your favicon class.

Please consider allowing compressed content encodings

Hi! First off, it seems that a lot of people are using your library -- congrats! Thank you for identifying it in the user-agent string.

I operate a website and, collectively, requests identifying themselves as coming from this library are starting to be a significant fraction of my bytes transferred. This is mostly because

  • It seems to issue requests for / on the server, which is an HTML page -- not a favicon, but ok
  • It doesn't support content-encoding for compressing data in flight.

Because it's fetching raw HTML so often, it's moving about 8-10x more bytes on each request than it would using accept-encoding: gzip. This is why it's come up in my analysis -- other libraries are pinging me more often, but are doing so in more efficient ways.

It's been 20 years since I did any PHP, or I'd offer a patch. From reading several related StackOverflow articles, it seems like the simplest way to send fancier HTTP requests would be to switch to using cURL instead of file_get_contents. But, I imagine there might be reasons why you don't want to do that, so, this page implies that detecting a gzipped response and applying gzdecode would suffice. Sending the accept-encodings header appears straightforward using the context mechanism that you're already using for other purposes.

Anyway, hope that's helpful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.