Code

e3df706147606b6a36b004965d9e7767e72ee4be
[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("127.0.0.1","20081",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>job_ping</header> <source>10.89.1.155:20083</source><mac>00:1B:77:04:8A:6C</mac> <timestamp>19700101000001</timestamp> </xml>";
16 #$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>";
17 #$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>";
19 # delete
20 #$data = "<xml> <header>gosa_delete_jobdb_entry</header><where><clause><phrase><id>3</id></phrase></clause></where></xml>";
22 # update  
23 #$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <where><clause><phrase> <status>waiting</status></phrase></clause> </where> <update><status>processing</status> <result>update</result></update></xml>";
25 # query
26 #$data = "<xml><header>gosa_query_jobdb</header><where><clause><connector>and</connector><phrase><operator>gt</operator><ROWID>0</ROWID></phrase><phrase><operator>le</operator><ROWID>5</ROWID></phrase></clause></where></xml>";
27 #$data= "<xml><header>gosa_query_jobdb</header><where><clause><phrase><headertag>ping</headertag></phrase></clause></where><limit><from>0</from><to>3</to></limit></xml>";
28 $data= "<xml><header>gosa_query_jobdb</header><where><clause><phrase><headertag>ping</headertag></phrase></clause></where><limit><from>0</from><to>9</to></limit><orderby>timestamp</orderby></xml>";
31 # count
32 #$data = "<xml> <header>gosa_count_jobdb</header></xml>";
35         
36 # clear
37 #$data = "<xml> <header>gosa_clear_jobdb</header> </xml>";
39     $sock->write($data);
40     $answer = "nothing";
41         $answer = $sock->read();
42     echo ">>>$answer<<<\n";
43         $sock->close(); 
44 }else{
45         echo "... FAILED!\n";
46 }
48 ?>