我有一个执行时的功能:
try {
$soapClientObj = new SoapClient("http://xxx.xxx/Post/Send.asmx?wsdl");
$parameters['username'] = "xxxx";
$parameters['password'] = "xxx";
$parameters['from'] = "xxx";
$parameters['to'] = $numbers;
$parameters['text'] = $text;
$parameters['recId'] = array(0);
$parameters['status'] = array(0);
print_r($soapClientObj->SendSms($parameters));
} catch (SoapFault $fault) {
echo "$fault";
}
返回此值
stdClass Object (
[SendSmsResult] => 1
[recId] => stdClass Object (
[long] => 4231441553676114840 )
[status] => )
我想打印4231441553676114840
,但我不知道该怎么做
如果可以,请帮助我,谢谢你
答案 0 :(得分:1)
这是如何:
try {
$soapClientObj = new SoapClient("http://path/to/wsdl/api/url");
$parameters['username'] = "xxxx";
$parameters['password'] = "xxx";
$parameters['from'] = "xxx";
$parameters['to'] = $numbers;
$parameters['text'] = $text;
$parameters['recId'] = array(0);
$parameters['status'] = array(0);
$response = $soapClientObj->SendSms($parameters);
$recId = $response->recId->long; // here is your variable
} catch (SoapFault $fault) {
echo "$fault";
}
答案 1 :(得分:0)
echo $soapClientObj->SendSms($parameters)->recId->long;