如何在HTML中输出WSDL请求的结果?

I wrote simple client

<?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

?>

How i can output in html $result?

var_dump result:

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)

Since your variable $result is of type stdClass and its property $GetGeoIPContextResult in which the data is stored (as strings) is also of type stdClass, you could do it in a straight forward manner, e.g.

// the IP address in a div
<div><?php echo $result->GetGeoIPContextResult->IP; ?></div>
// the country name in a div
<div><?php echo $result->GetGeoIPContextResult->CountryName; ?></div>
// the country code in a div
<div><?php echo $result->GetGeoIPContextResult->CountryCode; ?></div>

Additionally you could first check whether it was a success:

if ($result->GetGeoIPContextResult->ReturnCodeDetails == 'Success') {
    // insert here the code above
}

What do you mean by HTML?

If you only need to be able to read the values : you can display results in one go as JSON:

 $readable_json = json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
 echo '<pre>';
 echo $readable_json;
 echo '</pre>';

or you could use var_export

 $readable_dump = var_export($result, true);
 echo '<pre>';
 echo $readable_dump;
 echo '</pre>';

Silution is simple:

print $result->GetGeoIPContextResult->IP . '<br />';
print $result->GetGeoIPContextResult->ReturnCode . '<br />';
print $result->GetGeoIPContextResult->CountryName . '<br />';
print $result->GetGeoIPContextResult->CountryCode . '<br />';