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