PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

HttpRequest::addCookies

(PECL pecl_http >= 0.10.0)

HttpRequest::addCookiesAdd cookies

Description

public bool HttpRequest::addCookies ( array $cookies )

Add custom cookies.

Note: The request option encodecookies controls whether the cookie values should be urlencode()d.

Note: Affects any request method.

Parameters

cookies

an associative array containing any cookie name/value pairs to add

Return Values

Returns TRUE on success or FALSE on failure.

Examples

Example #1 A HttpRequest::addCookies() example

<?php
$r 
= new HttpRequest;
$r->addCookies(
    array(
        
"cookie_name" => "cookie value",
    )
);
?>

See Also

PHP Manual