Answer the question
In order to leave comments, you need to log in
How to display the results of a WSDL query in html?
Hello.
Wrote a simple client to work with a WSDL service.
<?php
$client = new SoapClient("http://www.webservicex.net/geoipservice.asmx?WSDL");
$result = $client->GetGeoIPContext();
var_dump($result);
print $result; // Issue: Catchable fatal error: Object of class stdClass could not be converted to string
?>
object(stdClass)[2]
public 'GetGeoIPContextResult' =>
object(stdClass)[3]
public 'ReturnCode' => int 1
public 'IP' => string '62.122.245.38' (length=13)
public 'ReturnCodeDetails' => string 'Success' (length=7)
public 'CountryName' => string 'Russian Federation' (length=18)
public 'CountryCode' => string 'RUS' (length=3)
Answer the question
In order to leave comments, you need to log in
Well, what is not clear? Your interpreter won't let you convert an object to a string because it doesn't know how to do it. You also know where the fields you need are located:
echo $result->GetGeoIPContextResult->IP;
echo $result->GetGeoIPContextResult->ReturnCode;
echo $result->GetGeoIPContextResult->CountryName;
echo $result->GetGeoIPContextResult->CountryCode;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question