Does the library support using cookies / http sessions?

In short: yes, but a little coding is needed to make it happen.

The code below uses sessions to e.g. let the client store a value on the server and retrieve it later.


$resp $client->send(new xmlrpcmsg('registervalue', array(new xmlrpcval('foo'), new xmlrpcval('bar'))));
if (!
$resp->faultCode())
{
  
$cookies $resp->cookies();
  if (
array_key_exists('PHPSESSID'$cookies)) // nb: make sure to use the correct session cookie name
  
{
    
$session_id $cookies['PHPSESSID']['value'];

    
// do some other stuff here...

    
$client->setcookie('PHPSESSID'$session_id);
    
$val $client->send(new xmlrpcmsg('getvalue', array(new xmlrpcval('foo')));
  }
}

Server-side sessions are handled normally like in any other php application. Please see the php manual for more information about sessions.

NB: unlike web browsers, not all xmlrpc clients support usage of http cookies. If you have troubles with sessions and control only the server side of the communication, please check with the makers of the xmlrpc client in use.