Location: PHPKode > scripts > PHP RPC Lite classes > php-rpc-lite-classes/lib/class.server.inc
<?
// PHP RPC Server (c) Gregogy A. Rozanoff, 2005

class RPC_Server {
 var $foo, $args, $res;

 /*
 Function:	RPC_Server
 Arguments:	string foo1, string foo2, ...
 Return:	none

 Initialize RPC server class
 */

 function RPC_Server() {
	$namespace = func_get_args();

	if ($_POST['defun'] == '_namespace') {
		echo serialize($namespace);
		exit;
	} else {
		$defun = unserialize(stripslashes($_POST['defun']));
		$this->foo = $defun['foo'];
		$this->args = $defun['args'];
		if (!in_array($this->foo, $namespace)) exit;
	}
 }

 /*
 Function:	close
 Arguments:	none
 Return:	none

 Execute user function and shutdown RPC-server.
 */

 function close() {
	ob_start();
	$res = call_user_func_array($this->foo, $this->args);
	echo urlencode(serialize($res));
	ob_end_flush();
	unset($this);
 }
}
?>
Return current item: PHP RPC Lite classes