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