Issues (209)

samples/client1.php (2 issues)

1
<?php
2
/*
3
 *	$Id: client1.php,v 1.3 2007/11/06 14:48:24 snichol Exp $
4
 *
5
 *	Client sample that should get a fault response.
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
$useCURL = isset($_POST['usecurl']) ? $_POST['usecurl'] : '0';
18
$client = new nusoap_client("http://soap.amazon.com/onca/soap2", false,
19
						$proxyhost, $proxyport, $proxyusername, $proxypassword);
20
$err = $client->getError();
21
if ($err) {
22
	echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
23
	echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
24
	exit();
25
}
26
$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

26
$client->setUseCurl(/** @scrutinizer ignore-type */ $useCURL);
Loading history...
27
// This is an archaic parameter list
28
$params = array(
29
    'manufacturer' => "O'Reilly",
30
    'page'         => '1',
31
    'mode'         => 'books',
32
    'tag'          => 'trachtenberg-20',
33
    'type'         => 'lite',
34
    'devtag'       => 'Your tag here',
35
    'sort'         => '+title'
36
);
37
$result = $client->call('ManufacturerSearchRequest', $params, 'http://soap.amazon.com', 'http://soap.amazon.com');
38
if ($client->fault) {
39
	echo '<h2>Fault (Expect - The request contains an invalid SOAP body)</h2><pre>'; print_r($result); echo '</pre>';
40
} else {
41
	$err = $client->getError();
42
	if ($err) {
43
		echo '<h2>Error</h2><pre>' . $err . '</pre>';
44
	} else {
45
		echo '<h2>Result</h2><pre>'; print_r($result); 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
?>
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...
52