Jaanus
Jaanus

Reputation: 16541

How to print out the object value returned by SoapClient?

<?php
   $client = new SoapClient("http://localhost:8080/calculator?wsdl");   
   $result = $client->add(3,3); 

   echo $result;

?>

Getting error:

Object of class stdClass could not be converted to string

How can I print out the response from SoapClient?

Upvotes: 0

Views: 608

Answers (2)

Rob Apodaca
Rob Apodaca

Reputation: 834

The result is a stdClass object. You can "print" an object using print_r which is a utility you can use to inspect the members of the object:

print_r($result);

Upvotes: 1

Popnoodles
Popnoodles

Reputation: 28409

Use print_r

print_r($result);

or var_dump

var_dump($results);

Upvotes: 1

Related Questions