Overview

Packages

  • Requests
    • Authentication
    • Cookies
    • Proxy
    • Session
    • Transport
    • Utilities

Classes

  • Requests
  • Requests_Response
  • Requests_Response_Headers

Exceptions

  • Requests_Exception
  • Requests_Exception_HTTP
  • Requests_Exception_HTTP_304
  • Requests_Exception_HTTP_305
  • Requests_Exception_HTTP_306
  • Requests_Exception_HTTP_400
  • Requests_Exception_HTTP_401
  • Requests_Exception_HTTP_402
  • Requests_Exception_HTTP_403
  • Requests_Exception_HTTP_404
  • Requests_Exception_HTTP_405
  • Requests_Exception_HTTP_406
  • Requests_Exception_HTTP_407
  • Requests_Exception_HTTP_408
  • Requests_Exception_HTTP_409
  • Requests_Exception_HTTP_410
  • Requests_Exception_HTTP_411
  • Requests_Exception_HTTP_412
  • Requests_Exception_HTTP_413
  • Requests_Exception_HTTP_414
  • Requests_Exception_HTTP_415
  • Requests_Exception_HTTP_416
  • Requests_Exception_HTTP_417
  • Requests_Exception_HTTP_418
  • Requests_Exception_HTTP_428
  • Requests_Exception_HTTP_429
  • Requests_Exception_HTTP_431
  • Requests_Exception_HTTP_500
  • Requests_Exception_HTTP_501
  • Requests_Exception_HTTP_502
  • Requests_Exception_HTTP_503
  • Requests_Exception_HTTP_504
  • Requests_Exception_HTTP_505
  • Requests_Exception_HTTP_511
  • Requests_Exception_HTTP_Unknown
  • Requests_Exception_Transport
  • Requests_Exception_Transport_cURL
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated

Warning! You are currently reading the documentation for Requests 1.x.

It is recommended to upgrade to Requests 2.x at your earliest convenience. Upgrading to Requests 2.x is fairly straight-forward.
A full list of the changes can be found in the Changelog.

Visit the documentation for Requests_Response in Requests 2.x.

Class Requests_Response

HTTP response class

Contains a response from Requests::request()

Package: Requests
Located at Requests/Response.php
Methods summary
public
# __construct( )

Constructor

Constructor

public boolean
# is_redirect( )

Is the response a redirect?

Is the response a redirect?

Returns

boolean
True if redirect (3xx status), false if not.
public
# throw_for_status( boolean $allow_redirects = true )

Throws an exception if the request was not successful

Throws an exception if the request was not successful

Parameters

$allow_redirects
Set to false to throw on a 3xx as well

Throws

Requests_Exception
If $allow_redirects is false, and code is 3xx (response.no_redirects)
Requests_Exception_HTTP
On non-successful status code. Exception class corresponds to code (e.g. Requests_Exception_HTTP_404)
Properties summary
public string $body

Response body

Response body

# ''
public string $raw

Raw HTTP data from the transport

Raw HTTP data from the transport

# ''
public Requests_Response_Headers $headers

Headers, as an associative array

Headers, as an associative array

# array()
public integer|boolean $status_code

Status code, false if non-blocking

Status code, false if non-blocking

# false
public float|boolean $protocol_version

Protocol version, false if non-blocking

Protocol version, false if non-blocking

# false
public boolean $success

Whether the request succeeded or not

Whether the request succeeded or not

# false
public integer $redirects

Number of redirects the request used

Number of redirects the request used

# 0
public string $url

URL requested

URL requested

# ''
public array $history

Previous requests (from redirects)

Previous requests (from redirects)

# array()
public Requests_Cookie_Jar $cookies

Cookies from the request

Cookies from the request

# array()
Requests 1.8.1 API Documentation API documentation generated by ApiGen