NOTE: For Version 3 of the AWS SDK for PHP, please see the V3 User Guide and V3 API Reference.

# Class BadResponseException

Http request exception thrown when a bad response is received

  Exception
  RuntimeException
  Guzzle\Common\Exception\RuntimeException implements Guzzle\Common\Exception\GuzzleException
  Guzzle\Http\Exception\RequestException implements Guzzle\Http\Exception\HttpException
  Guzzle\Http\Exception\BadResponseException

### Direct known subclasses

`Guzzle\Http\Exception\ClientErrorResponseException`, `Guzzle\Http\Exception\ServerErrorResponseException`, `Guzzle\Http\Exception\TooManyRedirectsException`

Namespace: Guzzle\Http\Exception
Located at Guzzle/Http/Exception/BadResponseException.php

## Methods summary

- `public static` `factory ( Guzzle\Http\Message\RequestInterface $request, Guzzle\Http\Message\Response $response )`

  Factory method to create a new response exception based on the response code.

- `public` `setResponse ( Guzzle\Http\Message\Response $response )`

  Set the response that caused the exception

- `public` `getResponse ( )`

  Get the response that caused the exception

## Methods detail

# `public static `Guzzle\Http\Exception\BadResponseException``
`factory( `Guzzle\Http\Message\RequestInterface` $request, `Guzzle\Http\Message\Response` $response )`

Factory method to create a new response exception based on the response code.

#### Parameters

$request
  ``Guzzle\Http\Message\RequestInterface``
  $request Request
$response
  ``Guzzle\Http\Message\Response``
  $response Response received

#### Returns

``Guzzle\Http\Exception\BadResponseException``
# `public`
`setResponse( `Guzzle\Http\Message\Response` $response )`

Set the response that caused the exception

#### Parameters

$response
  ``Guzzle\Http\Message\Response``
  $response Response to set

# `public `Guzzle\Http\Message\Response``
`getResponse( )`

Get the response that caused the exception

#### Returns

``Guzzle\Http\Message\Response``

### Methods inherited from Guzzle\Http\Exception\RequestException

`getRequest()`, `setRequest()`

### Methods inherited from Exception

`__construct()`, `__toString()`, `__wakeup()`, `getCode()`, `getFile()`, `getLine()`, `getMessage()`, `getPrevious()`, `getTrace()`, `getTraceAsString()`

### Magic methods summary

## Properties summary

### Properties inherited from Guzzle\Http\Exception\RequestException

`$request`

### Properties inherited from Exception

`$code`, `$file`, `$line`, `$message`