News for hackers. Stuff that matters.
Re:HTTPie: A cURL-like tool for humans by maratd on Wednesday July 18, 2012 @02:44PM (#4262212)
> Most humans don't operate the command line or write scripts to begin with.

I'm not a huge fan of cURL, but most people who use cURL don't use the command line either. They use the cURL library and access that functionality through a high level language (PHP, C, C++, whatever).

Re:HTTPie: A cURL-like tool for humans by TylerE on Wednesday July 18, 2012 @03:19PM (#4262413)
That's true, but it's no better there, either.

Here's some sample curl client code in PHP.

      $c = curl_init("https://someurl/some/api");
      $msg = /* some data here */
      $opts = array(
        CURLOPT_POST=>TRUE,
        CURLOPT_USERPWD=>"<password string>",
        CURLOPT_HTTPHEADER=>array("Content-type: application/json"),
        CURLOPT_POSTFIELDS=>$msg,
        CURLOPT_SSL_VERIFYPEER=>FALSE,
        CURLOPT_RETURNTRANSFER=>TRUE
      );
      curl_setopt_array($c, $opts);
      $d = curl_exec($c);
      curl_close($c);
Every option in that ugly argument array corresponds directly to a commandline option.
Re:HTTPie: A cURL-like tool for humans by manuletroll on Wednesday July 18, 2012 @05:35PM (#4263123)
On the other hand I guess you could probably write a nice library that uses curl under the hood, here it's just a case of ugly design.
Re:HTTPie: A cURL-like tool for humans by rmccue on Wednesday July 18, 2012 @10:58PM (#4264192)
Indeed, I do exactly that: http://requests.ryanmccue.info/

I completely agree on cURL's design though. It's painfully obvious when working with the cURL bindings in PHP that it didn't have much thought put in to adapting it to PHP's constraints and is essentially just the command line client in a "nice" wrapper. It ends up being a huge pain to work with.