当前位置: 代码迷 >> Web前端 >> PHP中怎么调用webservice
  详细解决方案

PHP中怎么调用webservice

热度:159   发布时间:2012-12-23 11:28:15.0
PHP中如何调用webservice
PHP中调用webservice
<?php
$info = new StdClass();
$info->checkword  = '';
$info->mobileno  = '15013882539';
$info->msg  = 'love asdflkj';
$info->msgtype  = 'ECP';
$info->resno  = 'SF';
$param=array($info);
$wsdl = "http://192.168.32.97:7001/WebMDSMS/services/procSMS?wsdl";
$cliente = new SoapClient($wsdl);
$vem = $cliente->__call('sendSMS',$param);
print $vem;
?>


nusoap调用webservice

<?php
require("./lib/nusoap.php");
$info = new StdClass();
$info->checkword  = '';
$info->mobileno  = '15013882539';
$info->msg  = 'love asdflkj';
$info->msgtype  = 'ECP';
$info->resno  = 'SF';
$param=array($info);
$client = new nusoap_client('http://192.168.32.97:7001/WebMDSMS/services/procSMS?wsdl', true);
$str=$client->call("sendSMS",$param);
if (!$client->getError())
{      
	echo " 程序返回 :".$str;
}
else{      
	echo " 错误 :".$err;
}

?>
  相关解决方案