Okay, first let me show you my script.
<?php
$soap_exception_occured = false;
$wsdl_path = 'http://vrapi.xyz.com/?wsdl';
$response = '';
ini_set('soap.wsdl_cache_enabled', '0'); // disabling WSDL cache
try {
$client = new SoapClient($wsdl_path);
}
catch(SoapFault $exception) {
$soap_exception_occured = true;
$response .= '\nError occoured when connecting to the SMS SOAP Server!';
$response .= '\nSoap Exception: '.$exception;
}
/* Create a Recharge at VR */
$client_id = 'appl45fgysssl';
$balance_info = new stdClass();
try {
$balance_info = $client->GetBalanceInfo($client_id);
}
catch(SoapFault $exception) {
$soap_exception_occured = true;
$response .= "\nError occoured at method GetBalanceInfo($client_id)";
$response .= "\nSoap Exception: ".$exception;
}
/* Do something or print results */
if($soap_exception_occured || $balance_info==null) echo $response;
else print_r($balance_info);
?>
And Output in browser
stdClass Object ( [client_user_id] => appl45fgysssl [available_credit] => 9755 [last_updated_time] => 2012-07-29 14:30:15 )
I want to display the data into a well arranged format. Ex.
Client: appl45fgysssl
Balance: 9755
Time: 2012-07-29 14:30:15
Please help me to do that. Any reference should be fine for me.
To output the results in a human readable form, as opposed to print_r, you could simply cycle through the results in a foreach loop;
Or for more specific naming, if you know what the columns are, using a
->to access the objects properties and echo them out;http://php.net/manual/en/sdo.sample.getset.php