$response = $client->ApiCallDeatilDataFeed($params);
print_r($response);
这是输出:
stdClass Object
(
[ApiCallDeatilDataFeedResult] => <ApidsfsdfCustomerReport>
<status>Success</status>
<report_creation_time>9/23/2022 11:27:40 PM</report_creation_time>
<tru_id>234244234</tru_id>
<report_date startdate="9/13/2012" enddate="9/14/2012" />
<call_data row="1">
<call_tracking_number>2324234324234</call_tracking_number>
<call_time>9/13/2012 3:33:46 PM</call_time>
<call_duration>128</call_duration>
<call_status>Answered</call_status>
<caller_number>43434543242</caller_number>
<caller_name></caller_name>
<caller_address>SAN JOSE CA 95117</caller_address>
<caller_city>SAN JOSE</caller_city>
<caller_state>CA</caller_state>
<caller_zip>95117</caller_zip>
<call_record_url></call_record_url>
</call_data>
</ApiCustomerReport>
)
使用soap方法接收以上输出时我需要将此格式显示为html表格式
答案 0 :(得分:0)
试试这个:
$response
是您在问题中转储的php对象。
<html>
<head>
<title></title>
</head>
<body>
<table border="0" cellpadding="2" cellspacing="3" width="100%">
<tr>
<th>Call Tracking Number</th>
<th>Call Time</th>
<th>Call Duration</th>
<th>Call Status</th>
<th>Caller Number</th>
<th>Caller Name</th>
<th>Caller Address</th>
<th>Caller City</th>
<th>Caller State</th>
<th>Caller Zip</th>
<th>Call Record Url</th>
</tr>
<?php
$xml = simplexml_load_string( $response->ApiCallDeatilDataFeedResult );
foreach ( $xml->call_data as $data )
{
?>
<tr>
<td><?php echo $data->call_tracking_number;?></td>
<td><?php echo $data->call_time;?></td>
<td><?php echo $data->call_duration;?></td>
<td><?php echo $data->call_status;?></td>
<td><?php echo $data->caller_number;?></td>
<td><?php echo $data->caller_name;?></td>
<td><?php echo $data->caller_address;?></td>
<td><?php echo $data->caller_city;?></td>
<td><?php echo $data->caller_state;?></td>
<td><?php echo $data->caller_zip;?></td>
<td><?php echo $data->call_record_url;?></td>
</tr>
<?php
}
?>
</table>
</body>
</html>
希望这有帮助。