-
-
Save sgolemon/e95bfc34d34c4f63fa953ee9294ae02c to your computer and use it in GitHub Desktop.
echo (new Curl('http://example.com')) | |
->setOpt(Curl::OPT_POSTFIELDS, $postdata) | |
->setOpt(Curl::OPT_FOLLOWLOCATION, 1) | |
->perform(); | |
$mh = (new Curl\Multi) | |
->addHandle($com = new Curl('http://example.com')) | |
->addHandle($net = new Curl('http://example.net')) | |
->addHandle($org = new Curl('http://example.org')) | |
->performUntilComplete(); | |
var_dump($com->getContent(), $net->getContent(), $org->getContent()); |
+1 :)
👍 I think this kind of approach can make the cURL adoption easier ! Especially for the multi handler...
Definitely nicer than the old way of doing things.
+1 would be super nice!
Great idea, CURL is used way more often than people like to admit.
"When in doubt, CURL it."
Having it OOP will be very nice.
+1 Nice
To be honest, curl is wrapped by so many user land libraries, I forgot how to actually use the functional approach :) It looks clean and neat, not sure if worth the effort.
Very nice. What about adding this to the curl extension using PCS ? Actually, one of the objectives of PCS is to allow adding an OO layer above function-only extensions without having to write it in C. I cannot dream of a better use case. Less than one hour of work to integrate it. If you send me your scripts, I'd be glad to build a POC.
looks nice 👍