XML_RPC2是否支持cookie?

I'm developing an XMLRPC client which must support cookies for authentification. How can I get response cookies and set request cookies with XML_RPC2?

Cookies are not supported by XML_RPC2

I assume you are using PHP / PEAR ?

Since Version 1.1.0b1 the package uses HTTP_Request2.

Create the HTTP_Request2 and pass it to the XML_RPC as option argument to use cookies:

 <?php
 //Include the PEAR packages
 require_once 'XML/RPC2/Client.php';
 require_once 'HTTP/Request2.php';

 //Create the HTTP_Request2 object and add your cookie details
 $http_request = new HTTP_Request2();
 $http_request2->addCookie($name = 'myCookie', $value = 'myValue');

 //Create the XML_RPC2_Client
 $params = array('httpRequest'=>$http_request);
 $client = XML_RPC2_Client::create($url = 'http://www.example.com', $params);
 //do your stuff

 ?>

XML_RPC2 supports cookie, for example:

require_once 'XML/RPC2/Client.php';
require_once 'HTTP/Request2.php';
require_once 'HTTP/Request2/CookieJar.php';

$http_request = new HTTP_Request2();
$cookie = new HTTP_Request2_CookieJar();
$http_request->setCookieJar($cookie);

$options = array(
    'prefix' => 'prefix.',
    'httpRequest' => $http_request
);

$client = XML_RPC2_Client::create('http://api.host.com/xmlrpc/', $options);

$result = $client->login('LOGIN', 'PASSWORD');

var_dump($cookie);

$result = $client->get_info();