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

Comments

Don't forget that you can access sites using streams. For example, file_get_contents('http://google.com'); will download the source of google's homepage.

Written by ryeguy

@ryeguy: And just because PHP is soo l33t doing file_put_contents('http://google.com', '...'); will hack Google homepage for you.

Written by Alix Axel

fie_get_contents() + stream_context can also be used to POST data (or call other HTTP methods needed for CouchDB and other REST calls)

Written by johannes

Accepted Answer

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

Written by Dominic Barnes
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki