SoapClient::__setCookie

(PHP 5 >= 5.0.4, PHP 7, PHP 8)

SoapClient::__setCookieDefines a cookie for SOAP requests

Description

public SoapClient::__setCookie(string $name, ?string $value = null): void

Defines a cookie to be sent along with the SOAP requests.

Note:

Calling this method will affect all following calls to SoapClient methods.

Parameters

name

The name of the cookie.

value

The value of the cookie. If not specified, the cookie will be deleted.

Return Values

No value is returned.

Changelog

Version Description
8.0.0 value is now nullable.
add a note

User Contributed Notes 2 notes

up
10
Jaygiri Goswami
12 years ago
You can access the cookies sent by SOAP server using $client->_cookies

Most you need to send session cookies back to server.
up
0
lukasz at szostak dot biz
18 years ago
On the server side you can access the cookie via $_COOKIE['cookie_name'].

Also remember that since HTTP is a stateless protocol, you have to send the cookie with every single SOAP call in order for it to be visible at server site.

It seems obvious but might save one a lot of time.
To Top