3 |
## $Id$ |
## $Id$ |
4 |
## -------------------------------------------------------------------------- |
## -------------------------------------------------------------------------- |
5 |
## $Log$ |
## $Log$ |
6 |
|
## Revision 1.4 2002/12/19 02:02:25 jonen |
7 |
|
## + minor changes |
8 |
|
## |
9 |
|
## Revision 1.3 2002/12/19 01:59:37 jonen |
10 |
|
## + minor changes: coment debug prints |
11 |
|
## |
12 |
|
## Revision 1.2 2002/12/05 21:45:31 joko |
13 |
|
## + debugging |
14 |
|
## |
15 |
## Revision 1.1 2002/12/01 17:23:58 joko |
## Revision 1.1 2002/12/01 17:23:58 joko |
16 |
## + initial check-in |
## + initial check-in |
17 |
## |
## |
31 |
|
|
32 |
function Remote($args = array()) { |
function Remote($args = array()) { |
33 |
global $cfg; |
global $cfg; |
34 |
|
//print "new Remote<br>"; |
35 |
$this->host = $cfg[rpcinfo][Host]; |
$this->host = $cfg[rpcinfo][Host]; |
36 |
$this->port = $cfg[rpcinfo][Port]; |
$this->port = $cfg[rpcinfo][Port]; |
37 |
if ($args['Host']) { $this->host = $args['Host']; } |
if ($args['Host']) { $this->host = $args['Host']; } |
38 |
if ($args['Port']) { $this->port = $args['Port']; } |
if ($args['Port']) { $this->port = $args['Port']; } |
39 |
} |
} |
40 |
|
|
41 |
function &send($command, $data = "") { |
function send($command, $data = "") { |
42 |
//$encoder = new Text_Encode($data); |
//$encoder = new Text_Encode($data); |
43 |
//$encoder->toUTF8(); |
//$encoder->toUTF8(); |
44 |
return $this->call($command, $data, 1); |
return $this->call($command, $data, 1); |
45 |
} |
} |
46 |
|
|
47 |
function &call($command, $data = "", $decode = 0) { |
function call($command, $data = "", $decode = 0) { |
48 |
|
|
49 |
|
// print "call: $command<hr>"; |
50 |
|
|
51 |
// data |
// data |
52 |
$data_enc = XML_RPC_encode($data); |
$data_enc = XML_RPC_encode($data); |
58 |
$rpc = new XML_RPC_Client("/", $this->host, $this->port); |
$rpc = new XML_RPC_Client("/", $this->host, $this->port); |
59 |
$rpc->setDebug(0); |
$rpc->setDebug(0); |
60 |
if ( !$msg_response = $rpc->send($msg) ) { |
if ( !$msg_response = $rpc->send($msg) ) { |
61 |
|
// TODO: redirect this error elsewhere! |
62 |
|
print "RPC-error!<br>"; |
63 |
return; |
return; |
64 |
} |
} |
65 |
// message - response |
// message - response |