Created
February 9, 2017 20:38
-
-
Save sgolemon/e95bfc34d34c4f63fa953ee9294ae02c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); |
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
+1 would be super nice!