Hello,
I was provided this code that works with PHP 5.0 I only have 4.something on my server. When I am running it, I am getting this error:
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/human/public_html/soap.php on line 8
<?php
function getError($e)
{
return "[$e->faultcode: $e->faultstring]";
}
class ApiCredentials
{
private $UserName;
private $Key;
public function __construct($UserName, $Key)
{
$this->UserName=$UserName;
$this->Key=$Key;
}
}
// Create the ApiCredentials object required by the API calls.
$apiCredentials = new ApiCredentials('demo', 'fakekey');
$creditialValues=new SoapVar($apiCredentials,SOAP_ENC_OBJECT);
$soapHeader=new SoapHeader('http://afd.com/api', 'ApiCredentials', $creditialValues);
// Create the soap client.
$client = new SoapClient(‘ngApi.wsdl’);
// Prepare the parameters to the function call
$pids = array();
array_push($pids, ‘1234567890’);
array_push($pids, ‘1234567890’);
$params = array('AneIDs'=>$pids);
try
{
// A sample function call
$objectresult = $client->__soapCall('DoLo', array('parameters' => $params), null, $soapHeader);
$returnValue = $objectresult->DoLo;
3
API Quick Start
}
catch(SoapFault $e)
{
$mesg = 'API error: '.getError($e);
}
?>
Any help would be cool. Thanks.