/[cvs]/nfo/php/libs/org.netfrag.flib/Application/RPC/Remote.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.flib/Application/RPC/Remote.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by joko, Sun Dec 1 17:23:58 2002 UTC revision 1.5 by jonen, Sun Dec 22 13:24:09 2002 UTC
# Line 3  Line 3 
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
10    ##    + minor changes
11    ##
12    ##    Revision 1.3  2002/12/19 01:59:37  jonen
13    ##    + minor changes: coment debug prints
14    ##
15    ##    Revision 1.2  2002/12/05 21:45:31  joko
16    ##    + debugging
17    ##
18  ##    Revision 1.1  2002/12/01 17:23:58  joko  ##    Revision 1.1  2002/12/01 17:23:58  joko
19  ##    + initial check-in  ##    + initial check-in
20  ##  ##
# Line 22  class Remote { Line 34  class Remote {
34        
35    function Remote($args = array()) {    function Remote($args = array()) {
36      global $cfg;      global $cfg;
37        //print "new Remote<br>";
38      $this->host = $cfg[rpcinfo][Host];      $this->host = $cfg[rpcinfo][Host];
39      $this->port = $cfg[rpcinfo][Port];      $this->port = $cfg[rpcinfo][Port];
40      if ($args['Host']) { $this->host = $args['Host']; }      if ($args['Host']) { $this->host = $args['Host']; }
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>";
57    
58    // print Dumper($data);
59    
60      // data      // data
61        $data_enc = XML_RPC_encode($data);        $data_enc = XML_RPC_encode($data);
# Line 42  class Remote { Line 63  class Remote {
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);
70        if ( !$msg_response = $rpc->send($msg) ) {        if ( !$msg_response = $rpc->send($msg) ) {
71            // TODO: redirect this error elsewhere!
72            print "RPC-error!<br>";
73          return;          return;
74        }        }
75      // message - response      // message - response

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.5

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed