我想使用 SOAP 获取外部服务的信息。当我对该 SOAP 调用进行 print_r 时,我得到:
stdClass Object (
[Ticket] => stdClass Object
(
[Timestamp] => 2012-07-24T17:46:01.306+02:00
[ExpiryTimestamp] => 2012-07-24T18:47:46.626+02:00
)
[FUP] => stdClass Object
(
[Period] => stdClass Object
(
[From] => 2012-06-25+02:00
[Till] => 2012-07-24+02:00
[CurrentDay] => 30
)
[Usage] => stdClass Object
(
[TotalUsage] => 75.1
[MinUsageRemaining] => 182.59
[MaxUsageRemaining] => 612.54
[Unit] => GB
[LastUpdate] => 2012-07-24T17:40:44.000+02:00
)
[Status] => Vrij verbruik
[StatusDescription] => stdClass Object
(
[NL] => Je surft met volledige surfsnelheid.
[FR] => Vous surfez à vitesse normale.
)
)
)
这是获取数据的 PHP 代码:
$wsdl_url = "https://t4t.services.telenet.be/TelemeterService.wsdl";
$client = new SoapClient($wsdl_url);
try
{
$result = $client->retrieveUsage(new SoapParam(array("UserId" => $userName, "Password" => $password), "RetrieveUsageRequestType"));
}
如何显示 TotalUsage 的数据?