Lusitanian/PHPoAuthLib — pull request #236 by bchecketts (2014-04-21 19:11:09+00:00)
Title: Adding Guzzle Client

Clean-up of my previous pull request #155.

Basic implementation of Guzzle HTTP client. Includes the ability to catch Guzzle Exceptions for non-2XX HTTP status codes, and thus read the HTTP body for errors and other important information

Sample Usage:

$serviceFactory = new \OAuth\ServiceFactory();
$guzzleClient = new OAuth\Common\Http\Client\GuzzleClient;
$serviceFactory->setHttpClient($guzzleClient);

$slapi = $serviceFactory->createService('SellerLabs', $credentials, $storage);

try {
$response = $slapi->request('/foo', 'GET');
} catch (OAuth\Common\Http\Exception\GuzzleException $e) {
$response = $e->getGuzzleResponse();
$http_status = $response->getStatusCode();
echo "

SLAPI Request returned a HTTP {$http_status} error

\n";
$error = $response->getBody();
echo "Raw Response:\n

". $error. "

\n";
}