Jump to content

PHP webservice


Pro.Luv

Recommended Posts

Hi,

 

I'm trying to call a .net(.asmx) webservice and it just doesn't work, I really need help with this.

 

    require("nusoap.php");
    $client = new nusoap_client('http://www.w3schools.com/webservices/tempconvert.asmx?wsdl', true);
    $err = $client->getError();
    
    if($err){
        Print '<h2>Constructor error</h2><pre>'.$err.'</pre>';
    }
    
    $param = array('Celsius' => '12') ; //PARAMETERS
    $function = 'CelsiusToFahrenheit'; //FUNCTION IM CALLING
    $result = $client->call($function, $param);
    
    if ($client->fault) {
            
            Print '<h2>Fault</h2><pre>';
            print_r($result);
            Print '</pre>';
            
    } else {
            
            $err = $client->getError(); // Check for errors
            
            if ($err) {
                
                Print '<h2>Error</h2><pre>'.$err.'</pre>'; // Display the error
                
            } else {
                // Display the result
                Print '<h2>Result</h2><pre>';
                print_r($result);
                Print '</pre>';
            }
            
    }

 

Thanks !

Link to comment
https://forums.phpfreaks.com/topic/231940-php-webservice/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.