Created
July 25, 2014 01:10
-
-
Save shin1x1/15ba58ae79449b8a5587 to your computer and use it in GitHub Desktop.
guzzle3_send_event_listener_sample
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
<?php | |
use Guzzle\Http\Client; | |
use Guzzle\Http\Curl\CurlMultiInterface; | |
use Symfony\Component\EventDispatcher\Event; | |
require_once __DIR__ . '/vendor/autoload.php'; | |
$client = new Client(); | |
$client->getEventDispatcher()->addListener(CurlMultiInterface::MULTI_EXCEPTION, function(Event $e) { | |
throw new Exception(); | |
}); | |
$curlMulti = $client->getCurlMulti(); | |
$curlMulti->setEventDispatcher($client->getEventDispatcher()); | |
$client->setCurlMulti($curlMulti); | |
$client->send(array( | |
$client->get('http://example.com/a'), | |
$client->get('http://example.com/b'), | |
$client->get('http://example.com/c'), | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment