-1

I'm trying to consume a soap web service using nusoap and PHP 5.6.25 but I am having some errors. Here is the php code:

    require_once 'nusoap-0.9.5/lib/nusoap.php';
    $client = new nusoap_client('http://www.webservicex.net/ConvertTemperature.asmx?WSDL');
    if($client->getError()){
        echo 'Error';
    } else {
        echo 'nusoap is working';
    }

Error:

Fatal error: Call to undefined function nusoap_client()

Elzo Valugi
  • 27,240
  • 15
  • 95
  • 114

1 Answers1

0

If you check any example on the internet about nusoap_client you can see that it looks like this:

$client = new nusoap_client("food.wsdl", true);
$error  = $client->getError();

So when you create a new instances of class nusoap_client you need to add the word new before. So your code will look like this:

$client = new nusoap_client('http://www.webservicex.net/ConvertTemperature.asmx?WSDL');
if($client->getError()){
    echo 'Error';
} else {
    echo 'nusoap is working';
}
Daniel Dudas
  • 2,972
  • 3
  • 27
  • 39