开发者

PHP PECL_HTTP vs cURL Extension

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.

As far as my qu开发者_如何学编程estion to the StackOverflow community:

  • Has anyone used both the PECL_HTTP and cURL extensions?
  • Does the PECL extension have any serious performance issues?
  • Is the PECL extension as user-friendly as it appears on the surface?
  • Is the tried-and-true cURL library still superior?

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.


In my opinion CURL is straightforward and easy to pick up. In PHP Cookbook (O'Reilly, 2002) CURL was chosen for various (performance) reasons.


The PECL_HTTP extension has proven much simpler to use, almost cutting my code in half in some places. :)


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.

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.

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

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...

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.

Something I would really appreciate is if php_http would do it into vanilla php.

Hope this helps some decision makers ;-)


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜