I want to download the contents of a URL using PHP, even if the HTTP response code is 404. file_get_contents will error out, and I wasn\'t able to find an answe
file_get_contents
By default file_get_contents only returns the content of HTTP 200 responses.
With curl you get the headers and the content separately.
As of PHP 5.0, you can also specify a context for file_get_contents, allowing you to do it without relying on url (See Gordon's answer).