file_get_contents vs cUrl。哪个更相关和安全? [英] file_get_contents vs cUrl. Which is more relevant and secure?

查看:211
本文介绍了file_get_contents vs cUrl。哪个更相关和安全?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在file_get_contents()的情况下,如果发生任何错误,它会显示错误msg中调用的网址

$ p

解决方案

我认为curl更安全,因为如果你使用远程文件file_get_contents需要启用'allow_url_fopen'



参考:

http://25labs.com/alternative-for-file_get_contents-using-curl/

http://phpsec.org/projects/phpsecinfo/tests/allow_url_fopen.html



并继续讨论从问题的意见,是cURL给你更多的选择,如果你想检查更多,你可以看到它在文档此处

对于file_get_contents(),它只是一个简单的GET请求。


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.

解决方案

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.

这篇关于file_get_contents vs cUrl。哪个更相关和安全?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆