Given the following code
$c= new SoapClient('http://www.webservicex.net/CurrencyConvertor.asmx?WSDL');
$usa = "USD";
$eng = "GBP";
doing a __getTypes on the client gives me
Array ( [0] => struct ConversionRate { Currency FromCurrency; Currency ToCurrency; } [1] => string Currency [2] => struct ConversionRateResponse { double ConversionRateResult; } )
if i then do
$calculation = $c->ConversionRate($usa, $eng);
and print calculation i get an error about
Catchable fatal error: Object of class stdClass could not be converted to string
Is there a specific way i should be printing this out, or i it a bug, from researching / googling many people seem to have a problem but i cant find a suitbale solution, other than downgrading php, which isnt a solution for me as i am doing this as homework and its running off of a college server
I’m guessing the return type from that function is not a string (or anything with
__toStringdefined). Normally instances of stdClass will have one or more properties which will be of use to you.Try doing something like:
That should tell you what the object has on it, and what it is you might want to do with it. I’d guess you’d want to be printing some property off there along the lines of (example):