4 ms·
> 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 lin
by maratd 14y ago
> 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).
- TylerE 14y agoThat'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.
- manuletroll 14y agoOn 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.
- rmccue 14y agoIndeed, I do exactly that: http://requests.ryanmccue.info/ 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.