ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
client3.php
Go to the documentation of this file.
1 <?php
2 /*
3  * $Id: client3.php,v 1.4 2007/11/06 14:48:24 snichol Exp $
4  *
5  * Client sample.
6  *
7  * Service: SOAP endpoint
8  * Payload: rpc/encoded
9  * Transport: http
10  * Authentication: none
11  */
12 require_once('../lib/nusoap.php');
13 $proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
14 $proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
15 $proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
16 $proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
17 $useCURL = isset($_POST['usecurl']) ? $_POST['usecurl'] : '0';
18 $client = new nusoap_client("http://api.google.com/search/beta2", false,
20 $err = $client->getError();
21 if ($err) {
22  echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
23  echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
24  exit();
25 }
26 $client->setUseCurl($useCURL);
27 $client->soap_defencoding = 'UTF-8';
28 
29 //echo 'You must set your own Google key in the source code to run this client!'; exit();
30 $params = array(
31  'Googlekey'=>'Your Google key',
32  'queryStr'=>'robotics',
33  'startFrom'=>0,
34  'maxResults'=>10,
35  'filter'=>true,
36  'restrict'=>'',
37  'adultContent'=>true,
38  'language'=>'',
39  'iencoding'=>'',
40  'oendcoding'=>''
41 );
42 $result = $client->call("doGoogleSearch", $params, "urn:GoogleSearch", "urn:GoogleSearch");
43 if ($client->fault) {
44  echo '<h2>Fault</h2><pre>'; print_r($result); echo '</pre>';
45 } else {
46  $err = $client->getError();
47  if ($err) {
48  echo '<h2>Error</h2><pre>' . $err . '</pre>';
49  } else {
50  echo '<h2>Result</h2><pre>'; print_r($result); echo '</pre>';
51  }
52 }
53 echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
54 echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
55 echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
56 ?>