标签为 "nusoap.php" 的存档

PHP调用基于Web服务的SOAP应用程序 WSDL

示例代码(调用香港的WSDL服务发送短信,为了安全,参数随便改了个,这个不能用的,大家不要用这个做例子),仅供参考用法:

<?php
	include "nusoap.php";
	$soap = new soapclient("http://wsp3.three.com.hk/axis/services/messaging?wsdl");
	$soap->soap_defencoding = 'utf-8';
	$soap->xml_encoding = 'utf-8';  
	
	$AccountID = 'weibiosinasmstest';
	$UserID = "sina-weibo";
	$Passwd = "weibo-sina";
	$ServiceID = "SMS";

	//以下是检查已发短信状态的接口 , $reference是发送短信接口返回值,表示短信ID
	$reference = "4651170";
	
	$result = $soap->__soapCall('getSMSByReference',array($AccountID, $UserID, $Passwd, $ServiceID, $reference));

	var_dump($result);
	/*返回结果:
		string(178) "<?xml version="1.0" encoding="UTF-8"?><response><result code="1000" datetime="20110803155234" desc="Message successfully delivered to the HTHK." reference="4631624"/></response>"

		code:状态代码
		datetime:发送时间
		desc:描述
		reference:短信ID
	*/

 
Read more…