<?php
class SoapClientEx extends SoapClient
{
/**
* @var null|SoapServer
*/
protected $server = null;
public function __construct($server, array $options)
{
parent::__construct(null, $options);
$this->server = $server;
}
public function __doRequest($request, $location, $action, $version, $one_way = 0)
{
ob_start();
$this->server->handle($request);
//header_remove();
return ob_get_clean();
}
}
class Test
{
function mult($a, $b) {
return $a * $b;
}
}
$server = new SoapServer(null, array(
'uri' => 'localhost'
));
$server->setClass('Test');
$client = new SoapClientEx($server, array(
'uri' => 'localhost',
'location' => 'localhost'
));
$result = $client->mult(2,3);
echo $result;
preferences:
37.33 ms | 402 KiB | 5 Q