Which would be more appropriate in terms of security?
In case of file_get_contents(), if any error occurs, it displays the url being called in the error msg which may be vulnerable.
Which would be more appropriate in terms of security?
In case of file_get_contents(), if any error occurs, it displays the url being called in the error msg which may be vulnerable.
file_get_content can do post by stream_context_set_option, but, i think maybe curl more powerful.
ref:
I think curl is more secure because if you're working with remote file with file_get_contents() you need to enable ‘allow_url_fopen’
reference :
http://25labs.com/alternative-for-file_get_contents-using-curl/
http://phpsec.org/projects/phpsecinfo/tests/allow_url_fopen.html
And continuing discussion from the comments in the question, yes cURL give you more option and if you want to check more you can see it in the documentation here
For file_get_contents() it just a simple GET request.
allow_url_fopen
on to access remote sourcesit displays the url being called in the error msg which may be vulnerable.
Turn off error reporting and ensure display_errors is deactivated. It may also be worthwhile to create your own handler to handle errors.