Take the 2-minute tour ×

Are there alternatives to CURL in PHP that will allow for a client to connect o a REST architecture server ?

PUT, DELETE, file upload are some of the things that need to work.

share|improve this question
cURL is not PHP specific, and libcurl could be added to your project curl.haxx.se/libcurl –  Scuzzy May 3 '11 at 4:27
it's not specific but it's easy to install and use. Similar solution are a good answer. –  danip May 3 '11 at 4:29
May I ask why you don't want to use cURL? –  Emil Vikström May 3 '11 at 4:36
I need something easy to install and generic so the clients don't have to rely on a single library in order to use the server. –  danip May 3 '11 at 4:44
add comment

2 Answers

up vote 2 down vote accepted

You can write your own library. It's even possible to do it completely in PHP, using fsockopen and friends. For example:

function httpget($host, $uri) {
  $msg = 'GET '.$uri." HTTP/1.1\r\n".
         'Host: '.$host."\r\n".
  $fh = fsockopen($host, 80);
  fwrite($fh, $msg);
  $result = '';
  while(!feof($fh)) {
    $result .= fgets($fh);
  return $result;
share|improve this answer
add comment

I recommend Zend_Http_Client (from Zend) or HTTP_Request2 (from PEAR). They both provide a well-designed object model for making HTTP requests.

In my personal experience, I've found the Zend version to be a little more mature (mostly in dealing with edge cases).

share|improve this answer
add comment

Your Answer


