Skip to content

Instantly share code, notes, and snippets.

@sgolemon
Created February 9, 2017 20:38
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sgolemon/e95bfc34d34c4f63fa953ee9294ae02c to your computer and use it in GitHub Desktop.
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());
@flaupretre
Copy link

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