Code

83f4470d6793cdad67f47ac5ddda6a110e546854
[gosa.git] / gosa-si / tests / client.php
1 #!/usr/bin/php5 -q
2 <?php
4 require_once("../../gosa-core/include/class_socketClient.inc");
5 error_reporting(E_ALL);
7 $sock = new Socket_Client("10.89.1.155","20082",TRUE,1);
8 #$sock = new Socket_Client("169.254.2.248","9999",TRUE,1);
9 $sock->setEncryptionKey("secret-gosa-password");
11 if($sock->connected()){
12         /* Prepare a hunge bunch of data to be send */
14 # add
15         #$data = "<xml><header>gosa_ping</header><source>10.89.1.155:20082</source><target></target><mac>11:22:33:44:55</mac></xml>";
16         #$data = "<xml> <header>job_ping</header> <source>10.89.1.155:20083</source><mac>00:1B:77:04:8A:6C</mac> <timestamp>19700101000000</timestamp> </xml>";
17         #$data = "<xml> <header>job_sayHello</header> <source>10.89.1.155:20083</source><mac>00:1B:77:04:8A:6C</mac> <timestamp>20130102133900</timestamp> </xml>";
18         #$data = "<xml> <header>job_ping</header> <source>10.89.1.155:20083</source><mac>00:1B:77:04:8A:6C</mac> <timestamp>20130102133900</timestamp> </xml>";
20 # delete
21         #$data = "<xml> <header>gosa_delete_jobdb_entry</header> <where>headertag</where> <headertag>sayHello</headertag> </xml>";
22         $data = "<xml> <header>gosa_clear_jobdb</header> </xml>";
24 # update  
25         #$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <where> <status>waiting</status> </where> <update> <status>processing</status> </update></xml>";
26         #$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <update> <status>waiting</status> </update></xml>";
27         #$data = "<xml> <header>gosa_update_timestamp_jobdb_entry</header> <update> <timestamp>20130123456789</timestamp> </update></xml>";
29 # query
30         #$data = "<xml><header>gosa_query_jobdb</header><where>status</where><status>waiting</status></xml>";
31         
32 # clear
33         #$data = "<xml> <header>gosa_clear_jobdb</header> </xml>";
35   $sock->write($data);
37         $answer = $sock->read();        
38   echo "$answer\n";
39         $sock->close(); 
40 }else{
41         echo "... FAILED!\n";
42 }
44 ?>