Overview

Packages

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

Classes

  • Requests_Cookie
  • Requests_Cookie_Jar
  • 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_Cookie_Jar in Requests 2.x.

Class Requests_Cookie_Jar

Cookie holder object

Requests_Cookie_Jar implements ArrayAccess, IteratorAggregate
Package: Requests\Cookies
Located at Requests/Cookie/Jar.php
Methods summary
public
# __construct( array $cookies = array() )

Create a new jar

Create a new jar

Parameters

$cookies
Existing cookie values
public Requests_Cookie
# normalize_cookie( string|Requests_Cookie $cookie, $key = null )

Normalise cookie data into a Requests_Cookie

Normalise cookie data into a Requests_Cookie

Parameters

$cookie
$key

Returns

Requests_Cookie
public Requests_Cookie
# normalizeCookie( $cookie, $key = null )

Normalise cookie data into a Requests_Cookie

Normalise cookie data into a Requests_Cookie

Deprecated

Use Requests_Cookie_Jar::normalize_cookie()

Returns

Requests_Cookie

Codecoverageignore

public boolean
# offsetExists( string $key )

Check if the given item exists

Check if the given item exists

Parameters

$key
Item key

Returns

boolean
Does the item exist?

Implementation of

ArrayAccess::offsetExists()
public string|null
# offsetGet( string $key )

Get the value for the item

Get the value for the item

Parameters

$key
Item key

Returns

string|null
Item value (null if offsetExists is false)

Implementation of

ArrayAccess::offsetGet()
public
# offsetSet( string $key, string $value )

Set the given item

Set the given item

Parameters

$key
Item name
$value
Item value

Throws

Requests_Exception
On attempting to use dictionary as list (invalidset)

Implementation of

ArrayAccess::offsetSet()
public
# offsetUnset( string $key )

Unset the given header

Unset the given header

Parameters

$key

Implementation of

ArrayAccess::offsetUnset()
public ArrayIterator
# getIterator( )

Get an iterator for the data

Get an iterator for the data

Returns

ArrayIterator

Implementation of

IteratorAggregate::getIterator()
public
# register( Requests_Hooker $hooks )

Register the cookie handler with the request's hooking system

Register the cookie handler with the request's hooking system

Parameters

$hooks
Hooking system
public
# before_request( string $url, array & $headers, array & $data, string & $type, array & $options )

Add Cookie header to a request if we have any

Add Cookie header to a request if we have any

As per RFC 6265, cookies are separated by '; '

Parameters

$url
$headers
$data
$type
$options
public
# before_redirect_check( Requests_Response $return )

Parse all cookies from a response and attach them to the response

Parse all cookies from a response and attach them to the response

Var

Requests_Response $response
Properties summary
protected array $cookies

Actual item data

Actual item data

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