コード例 #1
0
 public function testBatch()
 {
     $client = new Client();
     $client->query(1, 'subtract', array(3, 2));
     $client->notify('subtract', array(4, 3));
     $this->compare($client, '[{"jsonrpc":"2.0","id":1,"method":"subtract","params":[3,2]},{"jsonrpc":"2.0","method":"subtract","params":[4,3]}]');
 }
コード例 #2
0
ファイル: client.php プロジェクト: binwiederhier/php-json-rpc
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Datto\JsonRpc\Client;
$client = new Client();
$client->query(1, 'Math/subtract', array(5, 3));
$request = $client->encode();
echo $request, "\n";
// {"jsonrpc":"2.0","id":1,"method":"Math\/subtract","params":[5,3]}
コード例 #3
0
 public function query($id, $method, $arguments = null)
 {
     $this->client->query($id, $method, $arguments);
 }
コード例 #4
0
ファイル: client.php プロジェクト: shawnrc/php-json-rpc
<?php

use Datto\JsonRpc\Client;
require_once __DIR__ . '/../vendor/autoload.php';
$client = new Client();
$client->query(1, 'add', array(1, 2));
$message = $client->encode();
echo $message, "\n";
// {"jsonrpc":"2.0","id":1,"method":"add","params":[1,2]}