fopen和curl之间最大的区别是什么? [英] What are the biggest differences between fopen and curl?

查看:134
本文介绍了fopen和curl之间最大的区别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用PHP制作网络应用程序,并想要从其他域中读取内容。
似乎我的主要选项是 fopen curl

I am making a web application in PHP and want to read content from another domain. It seems that my major options are fopen and curl.

这两种方法之间的主要区别是什么,特别是关于安全性和可用选项?

What are the major differences between these two methods, especially regarding security and available options?

如果网址是http或https网站, ?

Does it matter if the url is an http or https site?

推荐答案

Curl使用外部库,它有更多的力量来定制请求 - 自定义头,生成POST请求,上传文件。一切你需要我必须说。

Curl uses external library and it has a lot more power to customizing the request - custom headers, generating POST request, uploading files. Everything you need I must say.

Fopen仅限于只做一个网址的GET请求,没有任何进一步的自定义。

Fopen is limited to only just make a GET request of the url without any further customization.

对于安全性CURL不受PHP中的安全配置的影响(例如远程URL等的禁用fopen)。

As for security CURL is not influenced by security configuration in PHP (like forbidden fopen of remote URLS and such).

你可以用你想要的每一种可能的方式。如果你在你的项目中产生一个安全漏洞,在获得数据之后,你的错误。

The both possibilities return you data which you can use in every possible way you want. If you make a security hole in your project, after getting the data is your fault after all.

也不太确定,但我认为fopen不能处理SSL(https)连接。 fopen和CURL都支持SSL(正如Andy Shellam在下面的注释中所指出的)。

Also I am not quite sure but I think that fopen cannot handle SSL (https) connections. Both fopen and CURL support SSL (as noted by Andy Shellam in a comment below).

这篇关于fopen和curl之间最大的区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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