Hi, I have a code below and I keep on getting the error "Fatal error: Call to a member function call() on a non-object in on line 29". Can someone help me please to fix and solve the error. Please help.
The line 29 here is the section that say
$this->apiresult = $this->apiclient->call($apimethodname);
but I think I already instantiated the $this->apiclient via the constructor
Please Help.
<?php
// includes nusoap class
require_once('lib/nusoap.php');
class dashcs
{
public $apiresult = null;
public $apierror = null;
public $apiclient = '';
function __constuct(&$apiclient)
{
// instantiate the web service api
$this->apiclient = $apiclient;
$this->apiclient->setCredentials("rrusdf","959dfde3","basic");
$this->apierror = $this->apiclient->getError();
if($this->apierror)
{
return false;
}else{
return true;
}
}
//
function dashCallMethod($apimethodname = null,$apiparameters= null)
{
// call the method of the service
if($apiparameters == null || $apiparameters == ''){
$this->apiresult = $this->apiclient->call($apimethodname);
}else{
$this->apiresult = $this->apiclient->call($apimethodname,$apiparameters);
}
if($this->apiclient->fault){
// check for fault
return false;
}else{
// Check for errors
$this->apierror = $this->apiclient->getError();
if ($this->apierror) {
return false;
}else{
return true;
}
}
}
}
// Create objects
$apiclient = new nusoap_client('https://service.dsdff.com/dash-api/soap/emergencyprovisioning/v1?wsdl', true);
$dash_api = new dashcs($apiclient);
if(!$dash_api)
{
echo $dash_api->apierror;
}
// check first the authentication
if($dash_api->dashCallMethod('getAuthenticationCheck'))
{
echo "API Error: $apierror";
print_r($dash_api->apiresult);
}else{
print_r($dash_api->apiresult);
}
?>