PHP Classes

File: examples/server.php

Recommend this page to a friend!
  Classes of Mark Rolich   JSON RPC Client and Server   examples/server.php   Download  
File: examples/server.php
Role: Example script
Content type: text/plain
Description: Example server
Class: JSON RPC Client and Server
Implements JSON RPC protocol client and server
Author: By
Last change: Update of examples/server.php
Date: 9 months ago
Size: 511 bytes
 

Contents

Class file image Download
<?php
include '../JsonRpcException.php';
include
'../JsonRpcServer.php';
include
'MathService.php';
include
'DataService.php';
include
'OptionalParamsService.php';

$math = new MathService();
$data = new DataService();
$optional = new OptionalParamsService();
$server = new JsonRpcServer();

$server->addService($math);
$server->addService($data);
$server->addService($optional);

$request = file_get_contents("php://input");
$result = $server->process($request);

if (
$result !== null) {
    echo
$result;
}
?>