| 3 |
## $Id$ |
## $Id$ |
| 4 |
## -------------------------------------------------------------------------- |
## -------------------------------------------------------------------------- |
| 5 |
## $Log$ |
## $Log$ |
| 6 |
|
## Revision 1.5 2002/12/22 13:24:09 jonen |
| 7 |
|
## + added utf8 encoding at 'send()' toggled by option |
| 8 |
|
## |
| 9 |
## Revision 1.4 2002/12/19 02:02:25 jonen |
## Revision 1.4 2002/12/19 02:02:25 jonen |
| 10 |
## + minor changes |
## + minor changes |
| 11 |
## |
## |
| 41 |
if ($args['Port']) { $this->port = $args['Port']; } |
if ($args['Port']) { $this->port = $args['Port']; } |
| 42 |
} |
} |
| 43 |
|
|
| 44 |
function send($command, $data = "") { |
function send($command, $data = "", $options = array()) { |
| 45 |
//$encoder = new Text_Encode($data); |
// do 'encode' here and ... |
| 46 |
//$encoder->toUTF8(); |
if ($options[utf8]) { |
| 47 |
return $this->call($command, $data, 1); |
$encoder = new TextEncode($data); |
| 48 |
|
$encoder->toUTF8(); |
| 49 |
|
} |
| 50 |
|
// call '_call' with 'decode' |
| 51 |
|
return $this->_call($command, $data, 1); |
| 52 |
} |
} |
| 53 |
|
|
| 54 |
function call($command, $data = "", $decode = 0) { |
function _call($command, $data = "", $decode = 0) { |
| 55 |
|
|
| 56 |
// print "call: $command<hr>"; |
//print "call: $command<hr>"; |
| 57 |
|
|
| 58 |
|
// print Dumper($data); |
| 59 |
|
|
| 60 |
// data |
// data |
| 61 |
$data_enc = XML_RPC_encode($data); |
$data_enc = XML_RPC_encode($data); |
| 63 |
// message - request |
// message - request |
| 64 |
$msg = new XML_RPC_Message($command); |
$msg = new XML_RPC_Message($command); |
| 65 |
$msg->addParam($data_enc); |
$msg->addParam($data_enc); |
| 66 |
|
//print htmlentities($msg->serialize()); |
| 67 |
// remote procedure call |
// remote procedure call |
| 68 |
$rpc = new XML_RPC_Client("/", $this->host, $this->port); |
$rpc = new XML_RPC_Client("/", $this->host, $this->port); |
| 69 |
$rpc->setDebug(0); |
$rpc->setDebug(0); |