Issues (209)

samples/wsdlclient13.php (1 issue)

1
<?php
2
/*
3
 *	$Id: wsdlclient13.php,v 1.2 2007/11/06 14:50:42 snichol Exp $
4
 *
5
 *	WSDL client sample.
6
 *
7
 *	Service: WSDL
8
 *	Payload: rpc/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
echo '<h2>Constructor</h2>';
18
$client = new nusoap_client('http://www.scottnichol.com/samples/session.php?wsdl', true,
19
						$proxyhost, $proxyport, $proxyusername, $proxypassword);
20
$err = $client->getError();
21
if ($err) {
22
	echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
23
}
24
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
25
$client->clearDebug();
26
// A persistent connection is *optional*, *not* necessary
27
$client->useHTTPPersistentConnection();
28
echo '<h2>GetSessionID</h2>';
29
$result = $client->call('GetSessionID', array());
30
// Check for a fault
31
if ($client->fault) {
32
	echo '<h2>Fault</h2><pre>';
33
	print_r($result);
34
	echo '</pre>';
35
} else {
36
	// Check for errors
37
	$err = $client->getError();
38
	if ($err) {
39
		// Display the error
40
		echo '<h2>Error</h2><pre>' . $err . '</pre>';
41
	} else {
42
		// Display the result
43
		echo '<h2>Result</h2><pre>';
44
		print_r($result);
45
		echo '</pre>';
46
	}
47
}
48
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
49
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
50
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
51
$client->clearDebug();
52
echo '<h2>SetSession</h2>';
53
$result = $client->call('SetSession', array('name' => 'testvalue', 'value' => 'it works'));
54
// Check for a fault
55
if ($client->fault) {
56
	echo '<h2>Fault</h2><pre>';
57
	print_r($result);
58
	echo '</pre>';
59
} else {
60
	// Check for errors
61
	$err = $client->getError();
62
	if ($err) {
63
		// Display the error
64
		echo '<h2>Error</h2><pre>' . $err . '</pre>';
65
	} else {
66
		// Display the result
67
		echo '<h2>Result</h2><pre>';
68
		print_r($result);
69
		echo '</pre>';
70
	}
71
}
72
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
73
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
74
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
75
$client->clearDebug();
76
echo '<h2>GetSession</h2>';
77
$result = $client->call('GetSession', array('name' => 'testvalue'));
78
// Check for a fault
79
if ($client->fault) {
80
	echo '<h2>Fault</h2><pre>';
81
	print_r($result);
82
	echo '</pre>';
83
} else {
84
	// Check for errors
85
	$err = $client->getError();
86
	if ($err) {
87
		// Display the error
88
		echo '<h2>Error</h2><pre>' . $err . '</pre>';
89
	} else {
90
		// Display the result
91
		echo '<h2>Result</h2><pre>';
92
		print_r($result);
93
		echo '</pre>';
94
	}
95
}
96
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
97
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
98
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
99
?>
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...
100