In order to check if an URL is an image, I use the PHP function get_headers
. In normal conditions, it works very well.
But when I'm behind a proxy, it causes a timeout exception. I had the same problem with file_put_contents
but I solved it by adding a context parameter. However, the get_headers
function hasn't a similar argument.
Do you know how to do please ?
Use
stream_context_set_default
function.This blog post explains how to use it. Here is the code from that page.