Menu

[r348]: / phprpc_2.1 / sample / client.php  Maximize  Restore  History

Download this file

33 lines (33 with data), 827 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
include('../php/phprpc_client.php');
$rpc_client = new phprpc_client();
$rpc_client->use_service('server.php', true);
$rpc_client->encrypt = 2;
echo $rpc_client->Add(1, 2);
echo "<br />";
echo $rpc_client->sub(1, 2);
echo "<br />";
$n = array(1);
$rpc_client->call('inc', &$n);
echo $n[0];
echo "<br />";
$rpc_client->hello("ÄãºÃ");
echo $rpc_client->output;
echo "<br />";
// error handle
echo "<pre>";
$result = $rpc_client->mul(1, 2);
if (get_class($result) == "phprpc_error") {
print_r($result);
}
$result = $rpc_client->add(1);
if (get_class($rpc_client->warning) == "phprpc_error") {
print_r($rpc_client->warning);
}
$rpc_client->use_service('wrong url');
$result = $rpc_client->add(1, 2);
if (get_class($result) == "phprpc_error") {
print_r($result);
}
echo "</pre>";
?>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.