Register


Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wired! php usage. Simple examples does not works.
06-02-2014, 03:27 AM (This post was last modified: 06-02-2014 03:28 AM by EK013.)
Post: #1
Wired! php usage. Simple examples does not works.
Where can i find last stable version of Wired "framework", please? I always get an errors even trying to execute example code.
Errors like:
PHP Code:
Fatal errorCall to a member function get_facility() on a non-object in /public_html/app/lib/wiredx.php on line 693 
Code:
PHP Code:
$wubook= new WuBook();
$wubook->init_wubook('EK013''00000''https://wubook.net:443/xrws/');
      
$custcreate_wbcustomer('mario''rossi''via via''city''IT',
                        
'mymail@addre.ss''333333''12:34''My Remarks');
      
$cccreate_wbcc(1'43423423421234''mario rossi''11''2009''870');
      
$res$wubook->book_now(1401186213$cust$cc); 

As you can see this is standard example… What am i doing wrong?

Another example:
PHP Code:
Fatal errorCall to a member function arraymem() on a non-object in /public_html/app/lib/wiredx.php on line 222 
Code:
PHP Code:
$wubook= new WuBook();
$wubook->init_wubook('EK013''00000''https://wubook.net:443/xrws/');
 
$myfacs= array(1401186213);
 
$wbf$wubook->facilities_request($myfacs'12/08/2009''15/08/2009'); 

Trying to do something with these errors second day. Downloaded Wired from wubook.net and xmlrpc.inc from official website.

Really need help.
Find all posts by this user
Quote this message in a reply
06-04-2014, 06:31 AM
Post: #2
RE: Wired! php usage. Simple examples does not works.
Hello,

the PHP client you have downloaded on our site is a very old sample. Wired must be considered stable, we receive ~1 milion queries / day and it's a core service!!!

But we have dropped from years the version of Wired to allow third parts to develop a booking engine. So, it seems you're using an old library which uses a not existent service.

If you need to develop an engine, check the Fount system and the Alien Plugin. Some links:

- Wired / Alien docs: https://sites.google.com/site/wubookdocs/wired
- Fount docs: https://sites.google.com/site/wubookdocs...book-fount

I'm sorry for the misunderstanding. Let me know if I can help you
Find all posts by this user
Quote this message in a reply
06-04-2014, 07:11 AM (This post was last modified: 06-04-2014 07:16 PM by EK013.)
Post: #3
RE: Wired! php usage. Simple examples does not works.
Thanks for info, i've already realized that even the host url is obsolete. I've started to develop own library based on documentation here:
https://sites.google.com/site/wubookdocs...l-examples

It can manage rooms, prices for defined dates already.
If you are interested i can send it when it will be ready or, if you open for me a repository, we can develop it together.

Here is first lines of it as example:
(any critics, advices, notices will be appreciated!)
PHP Code:
<?
//class KitWuBook

class KitWuBook {
    
//vars
    // private $var = 'default';
    
const HOST 'https://wubook.net:443/xrws/';

    private 
$srv;
    private 
$acc;
    private 
$pwd;
    private 
$lcd;

    private 
$err;

    
//init
    //username, password, enviroment - are usual parameters
    //$lcode = Facility ID, you can find it on Facility->Site tab in WuBook
    //For each facility you will need to create separate object
    
function __construct($username$password$lcode) {
        
        
$this->srv = new xmlrpc_client(self::HOST);
        
$this->srv->setSSLVerifyPeer(0);

        
$this->acc $username;
        
$this->pwd $password;
        
$this->lcd = (int)$lcode;

        
$this->err '';
    }


    
//methods

    //gets the token needed for every xmlrpc query
    
private function get_token(){
        
$msg = new xmlrpcmsg('get_token',
                               array(new 
xmlrpcval($this->acc'string'),
                                     new 
xmlrpcval($this->pwd'string')));

        
$token $this->srv->send($msg)->serialize()[1];

        return 
$token;
    }

    
//fetches all rooms, attached to current facility
    //result does not consist a price
    
public function fetch_rooms(){

        
$tok = new xmlrpcval($this->get_token(), 'string');
        
$lcd = new xmlrpcval($this->lcd'int');

        
$msg= new xmlrpcmsg('fetch_rooms', array($tok$lcd));
        
$struct $this->srv->send($msg);

        
$rooms xmlrpc_decode($struct->serialize())[1];

        return 
$rooms;
    }

    
//fetches defined rooms values or returns all rooms values if not defined last parameter
    
public function fetch_rooms_values($fromDate$toDate$rooms = array()){
        
        
$tok = new xmlrpcval($this->get_token(), 'string');
        
$lcd = new xmlrpcval($this->lcd'int');
        
$frd = new xmlrpcval($fromDate'string');
        
$tod = new xmlrpcval($toDate'string');

        if(
sizeof($rooms)>0){ 
            
$rms = new xmlrpcval($rooms'array');
            
$msg= new xmlrpcmsg('fetch_rooms_values', array($tok$lcd$frd$tod$rms));
        }else{
            
$msg= new xmlrpcmsg('fetch_rooms_values', array($tok$lcd$frd$tod));
        }
        
        
$rooms_values xmlrpc_decode($this->srv->send($msg)->serialize())[1];

        return 
$rooms_values;
    }

    
//sets new room values
    //for now works only with 1 defined room
    
public function update_rooms_values($fromDate$roomId$newPrice$min_stay 1$avail 1){
        
        
$tok   =     new xmlrpcval($this->get_token(), 'string');
        
$lcd   =     new xmlrpcval($this->lcd'int');
        
$frd   =     new xmlrpcval($fromDate'string');
        
$rid   =    new xmlrpcval($roomId'int');
        
$prc   =    new xmlrpcval($newPrice'double');
        
$avl   =    new xmlrpcval($avail'int');
        
$mst   =    new xmlrpcval($min_stay'int');

        
$rms =     new xmlrpcval( array(new xmlrpcval( array(
                                                        
'id'     => $rid,
                                                        
'days'    => new xmlrpcval( array(
                                                                                    new 
xmlrpcval( array(
                                                                                                    
'avail' => $avl,
                                                                                                    
'price' => $prc
                                                                                                    
), 'struct'),
                                                                                    new 
xmlrpcval( array(
                                                                                                    
'min_stay' => $mst
                                                                                                    
), 'struct')
                                                                                    ), 
'array')
                                                    ),
'struct')
                                ) , 
'array');

        
$msg= new xmlrpcmsg('update_rooms_values', array($tok$lcd$frd$rms));
        
        
$answer xmlrpc_decode($this->srv->send($msg)->serialize());

        return 
$answer;
    }


... 
Find all posts by this user
Quote this message in a reply
06-05-2014, 12:05 AM
Post: #4
RE: Wired! php usage. Simple examples does not works.
Oh,

it would be nice to develop an abstract PHP library for Wired. Can we eventually work on Github? If you have an account, feel free to publish your library there. And if you will alert us, for sure I will follow the project with my Github account. Or let me know how you prefere to go on!!
Find all posts by this user
Quote this message in a reply
10-16-2014, 02:20 AM
Post: #5
RE: Wired! php usage. Simple examples does not works.
Good, but what about push request-answer.
does anyone have examples?
Find all posts by this user
Quote this message in a reply
10-16-2014, 08:02 AM (This post was last modified: 10-16-2014 08:02 AM by DS051.)
Post: #6
RE: Wired! php usage. Simple examples does not works.
(10-16-2014 02:20 AM)PI005 Wrote:  Good, but what about push request-answer.
does anyone have examples?

Since then we forced the progress on our project, so we didn't finished this library. Unfortunately, we haven't more examples that these. But when we will continue our work for Wired! I can swear to contribute our code to public.

(10-16-2014 02:20 AM)PI005 Wrote:  Good, but what about push request-answer.
does anyone have examples?

Since then we forced the progress on our project, so we didn't finished this library. Unfortunately, we haven't more examples that these. But when we will continue our work for Wired! I can swear to contribute our code to public.
Find all posts by this user
Quote this message in a reply
10-20-2014, 07:46 PM
Post: #7
RE: Wired! php usage. Simple examples does not works.
Hi! We don't have more examples of those already published. All requests are documented here: https://sites.google.com/site/wubookdocs/wired
If you have some particular request, please ask: we're glad to help!
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: