I'm working on a PHP Client for CouchDB. While browsing through the php.net documentation regarding HTTP and cURL, I came across the PECL_HTTP Extension. At first glance, I think I would like to use this PECL extension instead of cURL because it's much simpler to use, and I'm not doing very complicated HTTP work anyways. Plus I always like trying new things, so I wouldn't mind getting my feet wet.
我正在为CouchDB开发PHP客户端。在浏览关于HTTP和cURL的php.net文档时,我遇到了PECL_HTTP扩展。乍一看,我想我想使用这个PECL扩展而不是cURL,因为它使用起来要简单得多,而且我不会做非常复杂的HTTP工作。另外,我总是喜欢尝试新事物,所以我不介意弄湿脚。
As far as my question to the * community:
至于我对*社区的问题:
- Has anyone used both the PECL_HTTP and cURL extensions?
- 有没有人同时使用PECL_HTTP和cURL扩展?
- Does the PECL extension have any serious performance issues?
- PECL扩展是否有任何严重的性能问题?
- Is the PECL extension as user-friendly as it appears on the surface?
- PECL扩展是否与表面上显示的用户友好?
- Is the tried-and-true cURL library still superior?
- 经过验证的cURL库是否仍然优越?
Edit: As it turns out, the PECL_HTTP extension uses some of the cURL source code under the hood, so they aren't completely different beasts. Both are also compiled extensions to PHP.
编辑:事实证明,PECL_HTTP扩展使用了引擎盖下的一些cURL源代码,因此它们不是完全不同的野兽。两者都是PHP的编译扩展。
4 个解决方案
#1
3
In my opinion CURL is straightforward and easy to pick up. In PHP Cookbook (O'Reilly, 2002) CURL was chosen for various (performance) reasons.
在我看来,CURL很简单,很容易上手。在PHP Cookbook(O'Reilly,2002)中,选择CURL是出于各种(性能)原因。
#2
2
The PECL_HTTP extension has proven much simpler to use, almost cutting my code in half in some places. :)
事实证明,PECL_HTTP扩展使用起来更简单,几乎在某些地方将代码减少了一半。 :)
#3
2
At first I have to say we used both at our company and from the handling I like php_http more and I appreciate the work of Mike.
起初我不得不说我们在公司和处理中都使用了php_http,我很欣赏Mike的工作。
But we abandoned php_http because it is not bundled in vanilla php. We are working in a windows environment and for each pecl extension which is not bundled by php itself, we have to compile it ourselves (which is not a bad thing). While compiling we got an error that some headers were missing. It turned out it was totally our fault, because it's clearly stated in the documentation.
但我们放弃了php_http,因为它没有捆绑在vanilla php中。我们正在Windows环境中工作,并且每个pecl扩展都没有被php本身捆绑,我们必须自己编译(这不是一件坏事)。在编译时,我们得到一些错误,一些标题丢失了。事实证明这完全是我们的错,因为它在文档中已经明确说明了。
And the since version 2.0 of php_http, it has two none-standard dependancies: - raphf 1.0.0 or newer - propro 1.0.0 or newer
从php_http的2.0版开始,它有两个非标准的依赖: - raphf 1.0.0或更新 - propro 1.0.0或更新版本
So we needed to compile more than only php_http. But for propro 1.0.0 (2013-08-12) config.w32 was missing in the download (at least in the state of writing). So we had to write our own one. And so on...
所以我们需要编译的不仅仅是php_http。但对于propro 1.0.0(2013-08-12),config.w32在下载中缺失(至少在写作状态下)。所以我们必须写自己的。等等...
In the end we got it working for PHP 5.5 VC11 x86, but it took some time. In companies you sometimes doesn't have time to spend on such things. Curl always works out of the box, because it's bundled. This might be a serious reason not to use php_http.
最后我们得到它适用于PHP 5.5 VC11 x86,但它花了一些时间。在公司中,您有时没有时间花在这些事情上。 Curl总是开箱即用,因为它是捆绑的。这可能是不使用php_http的严重原因。
Something I would really appreciate is if php_http would do it into vanilla php.
我真的很感激的是如果php_http会把它变成vanilla php。
Hope this helps some decision makers ;-)
希望这有助于一些决策者;-)
#4
0
I haven't try PECL_HTTP
yet. I prefer to use cURL, since I can test it out in command line first. Also, cURL is available in standard linux installation, so I can expect it to available in various linux-based hosting. I don't know about PECL availability, because I don't use any of it's function in my code.
我还没有尝试过PECL_HTTP。我更喜欢使用cURL,因为我可以先在命令行中测试它。此外,cURL可用于标准的Linux安装,因此我可以期待它可以在各种基于Linux的托管中使用。我不知道PECL的可用性,因为我在代码中没有使用它的任何功能。
#1
3
In my opinion CURL is straightforward and easy to pick up. In PHP Cookbook (O'Reilly, 2002) CURL was chosen for various (performance) reasons.
在我看来,CURL很简单,很容易上手。在PHP Cookbook(O'Reilly,2002)中,选择CURL是出于各种(性能)原因。
#2
2
The PECL_HTTP extension has proven much simpler to use, almost cutting my code in half in some places. :)
事实证明,PECL_HTTP扩展使用起来更简单,几乎在某些地方将代码减少了一半。 :)
#3
2
At first I have to say we used both at our company and from the handling I like php_http more and I appreciate the work of Mike.
起初我不得不说我们在公司和处理中都使用了php_http,我很欣赏Mike的工作。
But we abandoned php_http because it is not bundled in vanilla php. We are working in a windows environment and for each pecl extension which is not bundled by php itself, we have to compile it ourselves (which is not a bad thing). While compiling we got an error that some headers were missing. It turned out it was totally our fault, because it's clearly stated in the documentation.
但我们放弃了php_http,因为它没有捆绑在vanilla php中。我们正在Windows环境中工作,并且每个pecl扩展都没有被php本身捆绑,我们必须自己编译(这不是一件坏事)。在编译时,我们得到一些错误,一些标题丢失了。事实证明这完全是我们的错,因为它在文档中已经明确说明了。
And the since version 2.0 of php_http, it has two none-standard dependancies: - raphf 1.0.0 or newer - propro 1.0.0 or newer
从php_http的2.0版开始,它有两个非标准的依赖: - raphf 1.0.0或更新 - propro 1.0.0或更新版本
So we needed to compile more than only php_http. But for propro 1.0.0 (2013-08-12) config.w32 was missing in the download (at least in the state of writing). So we had to write our own one. And so on...
所以我们需要编译的不仅仅是php_http。但对于propro 1.0.0(2013-08-12),config.w32在下载中缺失(至少在写作状态下)。所以我们必须写自己的。等等...
In the end we got it working for PHP 5.5 VC11 x86, but it took some time. In companies you sometimes doesn't have time to spend on such things. Curl always works out of the box, because it's bundled. This might be a serious reason not to use php_http.
最后我们得到它适用于PHP 5.5 VC11 x86,但它花了一些时间。在公司中,您有时没有时间花在这些事情上。 Curl总是开箱即用,因为它是捆绑的。这可能是不使用php_http的严重原因。
Something I would really appreciate is if php_http would do it into vanilla php.
我真的很感激的是如果php_http会把它变成vanilla php。
Hope this helps some decision makers ;-)
希望这有助于一些决策者;-)
#4
0
I haven't try PECL_HTTP
yet. I prefer to use cURL, since I can test it out in command line first. Also, cURL is available in standard linux installation, so I can expect it to available in various linux-based hosting. I don't know about PECL availability, because I don't use any of it's function in my code.
我还没有尝试过PECL_HTTP。我更喜欢使用cURL,因为我可以先在命令行中测试它。此外,cURL可用于标准的Linux安装,因此我可以期待它可以在各种基于Linux的托管中使用。我不知道PECL的可用性,因为我在代码中没有使用它的任何功能。