Using file_get_contents as part of custom SOAP implementation to apply SOAP calls (ALL libraries that we tried would not do SSL + certificate based authentication with SOAP 1.2 correctly). However difficult and barely-documented API often returns 500. There are error details in response body, but file_get_contents doesn't appear to allow access to it. fopen seems to have the same issue.
What do?
Prefer not to go to cURL due to heavy use of stream contexts to get authentication working.
The function returns the read data or false on failure. This function may return Boolean false , but may also return a non-Boolean value which evaluates to false .
The file_get_contents() reads a file into a string. This function is the preferred way to read the contents of a file into a string. It will use memory mapping techniques, if this is supported by the server, to enhance performance.
file_get_contents() is slightly faster than cURL.
2 Answers. Show activity on this post. The first two, file and file_get_contents are very similar. They both read an entire file, but file reads the file into an array, while file_get_contents reads it into a string.
You might consider nusoap.
For your question though, it works if you use ignore_errors
.
$context = stream_context_create(array( 'http' => array( 'ignore_errors' => true ) )); $contents = file_get_contents($url, false, $context);
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