phpcurlget-headers

PHP get_headers and curl both give empty result


I know there is some similar topic, but not the same. I have a working code, tested with a lot of different url - http and https as well - without any problem. Then, I found a website ... when I asking the URL header, I got empty array answer.

get_headers("https://www.diversalertnetwork.org/diving-incidents/Divers-air-consumption-appeared-unbelievably-good", 1);

And the result is an EMPTY array.

Array
(
)

I am also try with CURL but same result. I try to download the url's content but nothing. You can try it. Surprise! If I modify to http:// from https://, it will start working. Of course, the https link working very well in a browser. Also, the get_headers working with other https:// links. With curl I using my own browser's useragent, so that is a real if the server try to detect for any security reason. I really do not know what can I do, and most important, what happening, why there is no any answer, not an error or whatever.

php 5.6


Solution

  • My browser shows warning about that site's HTTPS connection:

    The connection to this site uses an obsolete protocol (TLS 1.0), an obsolete key exchange (RSA), and an obsolete cipher (3DES_EDE_CBC with HMAC-SHA1).

    So it might simply be that on your system making HTTPS connections with sites that only support outdated security protocols is disabled.


    Which Apache config settings regarding SSL are relevant, can be found here: https://superuser.com/a/882651