Last active
August 29, 2015 14:20
-
-
Save benwaine/f09c86e18370c7af5eb2 to your computer and use it in GitHub Desktop.
Capturing the response object in Guzzle 5
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 | |
if (isset($this->username)) { | |
$args['user'] = $this->username; | |
} | |
$command = $this->client->getCommand($command, $args); | |
$command->getEmitter()->on('process', function(ProcessEvent $event) { | |
$this->response = $event->getResponse(); | |
}); | |
try { | |
$this->result = $this->client->execute($command); | |
} catch (\GuzzleHttp\Command\Exception\CommandClientException $e) { | |
// No Op - Response is saved above for interigation | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment