[ Index ]
 

Code source de nusoap 0.7.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/samples/ -> client3.php (source)

   1  <?php
   2  /*

   3   *    $Id: client3.php,v 1.2 2004/01/26 07:15:20 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  $client = new soapclient("http://api.google.com/search/beta2", false,
  18                          $proxyhost, $proxyport, $proxyusername, $proxypassword);
  19  $err = $client->getError();
  20  if ($err) {
  21      echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
  22  }
  23  $client->soap_defencoding = 'UTF-8';
  24  
  25  echo 'You must set your own Google key in the source code to run this client!'; exit();
  26  $params = array(
  27      'Googlekey'=>'set your own Google key',
  28      'queryStr'=>'robotics',
  29      'startFrom'=>0,
  30      'maxResults'=>10,
  31      'filter'=>true,
  32      'restrict'=>'',
  33      'adultContent'=>true,
  34      'language'=>'',
  35      'iencoding'=>'',
  36      'oendcoding'=>''
  37  );
  38  $result = $client->call("doGoogleSearch", $params, "urn:GoogleSearch", "urn:GoogleSearch");
  39  if ($client->fault) {
  40      echo '<h2>Fault</h2><pre>'; print_r($result); echo '</pre>';
  41  } else {
  42      $err = $client->getError();
  43      if ($err) {
  44          echo '<h2>Error</h2><pre>' . $err . '</pre>';
  45      } else {
  46          echo '<h2>Result</h2><pre>'; print_r($result); echo '</pre>';
  47      }
  48  }
  49  echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
  50  echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
  51  echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
  52  ?>


Généré le : Mon Sep 10 13:53:24 2007 par Balluche grâce à PHPXref 0.7