Issues (209)

samples/wsdlclient2.php (3 issues)

1
<?php
2
/*
3
 *	$Id: wsdlclient2.php,v 1.3 2007/11/06 14:48:49 snichol Exp $
4
 *
5
 *	WSDL client sample.
6
 *
7
 *	Service: WSDL proxy
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://soap.amazon.com/schemas2/AmazonWebServices.wsdl", 'wsdl',
19
						$proxyhost, $proxyport, $proxyusername, $proxypassword);
20
$err = $client->getError();
21
if ($err) {
22
	echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
23
	exit();
24
}
25
$client->setUseCurl($useCURL);
0 ignored issues
show
It seems like $useCURL can also be of type string; however, parameter $use of Nusoap_client::setUseCURL() does only seem to accept boolean, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

25
$client->setUseCurl(/** @scrutinizer ignore-type */ $useCURL);
Loading history...
26
$proxy = $client->getProxy();
27
$param = array(
28
	'browse_node' => 18,
29
	'page' => 1,
30
	'mode' => 'books',
31
	'tag' =>'melonfire-20',
32
	'type' => 'lite',
33
	'devtag' => 'Your dev tag'
34
);
35
$result = $proxy->BrowseNodeSearchRequest($param);
36
// Check for a fault
37
if ($proxy->fault) {
38
	echo '<h2>Fault</h2><pre>';
39
	print_r($result);
40
	echo '</pre>';
41
} else {
42
	// Check for errors
43
	$err = $proxy->getError();
44
	if ($err) {
45
		// Display the error
46
		echo '<h2>Error</h2><pre>' . $err . '</pre>';
47
	} else {
48
		// Display the result
49
		echo '<h2>Result</h2><pre>';
50
		print_r($result);
51
		echo '</pre>';
52
	}
53
}
54
echo '<h2>Request</h2><pre>' . htmlspecialchars($proxy->request, ENT_QUOTES) . '</pre>';
55
echo '<h2>Response</h2><pre>' . htmlspecialchars($proxy->response, ENT_QUOTES) . '</pre>';
56
echo '<h2>Client 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...
57
echo '<h2>Proxy Debug</h2><pre>' . htmlspecialchars($proxy->debug_str, ENT_QUOTES) . '</pre>';
58
?>
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...
59