Issues (209)

samples/wsdlclient5.php (4 issues)

1
<?php
2
/*
3
 *	$Id: wsdlclient5.php,v 1.4 2007/11/06 14:49:10 snichol Exp $
4
 *
5
 *	WSDL client sample.
6
 *
7
 *	Service: WSDL
8
 *	Payload: rpc/encoded
9
 *	Transport: http
10
 *	Authentication: none
11
 */
12
require_once('../lib/nusoap.php');
13
require_once('../lib/class.wsdlcache.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
20
$cache = new wsdlcache('.', 60);
0 ignored issues
show
The type wsdlcache was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
21
$wsdl = $cache->get('http://www.xmethods.net/sd/2001/BNQuoteService.wsdl');
22
if (is_null($wsdl)) {
23
	$wsdl = new wsdl('http://www.xmethods.net/sd/2001/BNQuoteService.wsdl',
24
					$proxyhost, $proxyport, $proxyusername, $proxypassword,
25
					0, 30, null, $useCURL);
0 ignored issues
show
It seems like $useCURL can also be of type string; however, parameter $use_curl of wsdl::__construct() 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
					0, 30, null, /** @scrutinizer ignore-type */ $useCURL);
Loading history...
26
	$err = $wsdl->getError();
27
	if ($err) {
28
		echo '<h2>WSDL Constructor error (Expect - 404 Not Found)</h2><pre>' . $err . '</pre>';
29
		echo '<h2>Debug</h2><pre>' . htmlspecialchars($wsdl->getDebug(), ENT_QUOTES) . '</pre>';
30
		exit();
31
	}
32
	$cache->put($wsdl);
33
} else {
34
	$wsdl->clearDebug();
35
	$wsdl->debug('Retrieved from cache');
36
}
37
$client = new nusoap_client($wsdl, 'wsdl',
38
						$proxyhost, $proxyport, $proxyusername, $proxypassword);
39
$err = $client->getError();
40
if ($err) {
41
	echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
42
	exit();
43
}
44
$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

44
$client->setUseCurl(/** @scrutinizer ignore-type */ $useCURL);
Loading history...
45
$params = array('isbn' => '0060188782');
46
$result = $client->call('getPrice', $params);
47
// Check for a fault
48
if ($client->fault) {
49
	echo '<h2>Fault</h2><pre>';
50
	print_r($result);
51
	echo '</pre>';
52
} else {
53
	// Check for errors
54
	$err = $client->getError();
55
	if ($err) {
56
		// Display the error
57
		echo '<h2>Error</h2><pre>' . $err . '</pre>';
58
	} else {
59
		// Display the result
60
		echo '<h2>Result</h2><pre>';
61
		print_r($result);
62
		echo '</pre>';
63
	}
64
}
65
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
66
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
67
echo '<h2>Cache Debug</h2><pre>' . htmlspecialchars($cache->getDebug(), ENT_QUOTES) . '</pre>';
68
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
69
?>
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...
70