The function get_headers()
doesn't supports a timeout or a context param. Try:
ini_set('default_socket_timeout', YOUR_VALUE_IN_SECONDS);
This will set the default timeout to a value of your choice. Don't forget to reset the timeout after the operation has finished.