Developers Cookbook

PHP

1. PHP 5.0+ SOAP Client
2. PHP SOAP Client PEAR SOAP Example
3. PHP WSDL Client nuSOAP
4. PHP WSDL Client PEAR SOAP

1 PHP 5.0+ SOAP Client


  1. Requires PHP 5.0 +
  2. WSDL ensures that SSL (https) is used for the SOAP call.
  3. Insert the code below into your php script.
try{
	$client = new \SoapClient('https://www.unifiedsoftware.co.uk/BankValukall2.wsdl');
	$params = $userid.'|'.$pin.'|'.$sortcode.'|'.$account;
	$result = $client->bankvalplus2($params);
	print_r($result);
}
catch(\SoapFault $sf){
	$errorMessage = $sf->getMessage();
}

<< back to top >>

2 PHP SOAP Client PEAR SOAP Example


This example access the service directly using its SOAP interface, i.e. without generating the proxy code from wsdl.

  1. Requires PEAR::SOAP. This package is available from Pear http://pear.php.net/.
  2. If curl_exec timeout problems encountered, increase timeout parameter in http.php.
  3. Insert the code below into your php script, populating the variables $userid, $PIN, $sortcode and $account as appropriate.
  4. Note use of https in url. If you use http instead, bankval will return the message 'Insecure Connection'.
require_once 'SOAP/Client.php';

$client = new SOAP_Client
('https://www.unifiedsoftware.co.uk/cgi-bin/bankvalSOAP.cgi');
$paramstring = $userid . "|" . $PIN . "|" . $sortcode . "|"
. $account; $params = array('params'=> $paramstring);
$result = $client->
call('bankvalidate',$params, array('namespace'=>'urn:BankValSOAP'));

if (PEAR::isError($result))
print("Error: " . $result->getMessage() . "\n");

print_r ($result);

<< back to top >>

3 PHP WSDL Client nuSOAP


  1. Requires nuSOAP. nuSOAP is available from http://dietrich.ganx4.com/nusoap/index.php
  2. WSDL ensures that SSL (https) is used for the SOAP call.
  3. Insert the code below into your php script. Note that parameter string must be passed as an array.
  4. 'require' path is implementation dependent.
require '~inc/nusoap.php';

$userid = trim($_POST['userid']);
$PIN = trim($_POST['PIN']);
$sortcode = trim($_POST['sortcode']);
$account = trim($_POST['account']);
$result = NULL;

$client = new soapclient('http://www.unifiedsoftware.co.uk/BankValukall2.wsdl', true);

$err = $client->getError();

if ($err)
{
echo 'Constructor error' . $err;
}

$paramstring = $userid . "|" . $PIN" . "|" . $sortcode . "|" . $account;
$params = array((string) $paramstring);
$result = $client->call('bankvalidate', $params);
$err = $client->getError();

if ($err)
{
echo 'Error' . $err;
}

print_r ($result);

<< back to top >>

4. PHP WSDL Client PEAR SOAP


  1. Requires PEAR::SOAP. This package is available from Pear http://pear.php.net/.
  2. If curl_exec timeout problems encountered, increase timeout parameter in http.php
  3. WSDL ensures that SSL (https) is used for the SOAP call.
  4. Insert the code below into your php script, populating the variables:
$userid, $PIN, $sortcode and $account as appropriate.

require_once 'SOAP/Client.php';

$wsdl = new SOAP_WSDL("http://www.unifiedsoftware.co.uk/BankValukall2.wsdl");
$client = $wsdl->getProxy();
$params = $userid . "|" . $PIN . "|" . $sortcode . "|" . $account;
$result = $client->bankvalidate($params);

if (PEAR::isError($result))
print("Error: " . $result->getMessage() . "\n");

print_r ($result);

<< back to top >>

Our customers