ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
mimeclient.php
Go to the documentation of this file.
1 <?php
2 /*
3  * $Id: mimeclient.php,v 1.6 2007/04/16 22:08:17 snichol Exp $
4  *
5  * MIME 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 require_once('../lib/nusoapmime.php');
14 $proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
15 $proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
16 $proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
17 $proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
18 $useCURL = isset($_POST['usecurl']) ? $_POST['usecurl'] : '0';
19 $client = new nusoap_client_mime('http://www.scottnichol.com/samples/mimetest.php', false,
21 $err = $client->getError();
22 if ($err) {
23  echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
24 }
25 $client->setUseCurl($useCURL);
26 $client->setHTTPEncoding('deflate, gzip');
27 $cid = $client->addAttachment('', 'mimeclient.php');
28 $result = $client->call('hello', array('name' => 'Scott'));
29 if ($client->fault) {
30  echo '<h2>Fault</h2><pre>'; print_r($result); echo '</pre>';
31 } else {
32  $err = $client->getError();
33  if ($err) {
34  echo '<h2>Error</h2><pre>' . $err . '</pre>';
35  } else {
36  echo '<h2>Result</h2><pre>'; print_r($result); echo '</pre>';
37  echo '<h2>Attachments</h2><pre>';
38  $attachments = $client->getAttachments();
39  foreach ($attachments as $a) {
40  echo 'Filename: ' . $a['filename'] . "\r\n";
41  echo 'Content-Type: ' . $a['contenttype'] . "\r\n";
42  echo 'cid: ' . htmlspecialchars($a['cid'], ENT_QUOTES) . "\r\n";
43  echo htmlspecialchars($a['data'], ENT_QUOTES);
44  echo "\r\n";
45  }
46  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>ResponseData</h2><pre>' . htmlspecialchars($client->responseData, ENT_QUOTES) . '</pre>';
52 echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
53 ?>