Issues (209)

samples/wsdlclient1.php (2 issues)

1
<?php
2
/*
3
 *	$Id: wsdlclient1.php,v 1.3 2007/11/06 14:48:48 snichol Exp $
4
 *
5
 *	WSDL client sample.
6
 *
7
 *	Service: WSDL
8
 *	Payload: document/literal
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 nusoap_client('http://www.xignite.com/xquotes.asmx?WSDL', 'wsdl',
18
						$proxyhost, $proxyport, $proxyusername, $proxypassword);
19
$err = $client->getError();
20
if ($err) {
21
	echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
22
}
23
// Doc/lit parameters get wrapped
24
$param = array('Symbol' => 'IBM');
25
$result = $client->call('GetQuickQuotes', array('parameters' => $param), '', '', false, true);
26
// Check for a fault
27
if ($client->fault) {
28
	echo '<h2>Fault</h2><pre>';
29
	print_r($result);
30
	echo '</pre>';
31
} else {
32
	// Check for errors
33
	$err = $client->getError();
34
	if ($err) {
35
		// Display the error
36
		echo '<h2>Error</h2><pre>' . $err . '</pre>';
37
	} else {
38
		// Display the result
39
		echo '<h2>Result</h2><pre>';
40
		print_r($result);
41
		echo '</pre>';
42
	}
43
}
44
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
45
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
46
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
0 ignored issues
show
The property debug_str is declared private in Nusoap_base and cannot be accessed from this context.
Loading history...
47
?>
0 ignored issues
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
48