我想使用SOAP獲取外部服務的信息。當我這樣做SOAP調用的print_r的我得到:PHP SOAP stdClass
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的數據?
你能做到'$ result'的'print_r'並用正確的格式輸出,而不是在一行上編輯文章。很難說在一條線上哪些屬性屬於哪些屬性。 – drew010 2012-07-24 18:23:11
改變了這一點。這是print_r如何返回它。 – user1079160 2012-07-24 18:25:57
如果您查看頁面源代碼,它應該被正確隔開幷包含換行符。然後將每行縮進4個空格,或單擊SO上的代碼按鈕以正確格式化。這仍然很難閱讀。謝謝 – drew010 2012-07-24 18:26:41