The documentation of file_get_contents says
On failure, file_get_contents() will return FALSE.
I am integrating with a system which returns error messages in the response and sets the status code to "50x"
Is there a way, I can still fetch the response content ?
$curl = curl_init('http://example.net');
curl_setopt( $curl, CURLOPT_RETURNTRANSFER,1);
$result = curl_exec($curl);
curl_close($curl);
however this may not satisfy your needs, as it requires curl
you may also ignore errors, to still use file_get_contents
$contents = file_get_contents($url, FALSE, stream_context_create(array(
'http' => array(
'ignore_errors' => true
)
));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With