时代互联短信接口,smsapimode_php_2_3

源代码在线查看: sms.inc.php

软件大小: 106 K
上传用户: singwolf
关键词: smsapimode_php 互联 短信 接口
下载地址: 免注册下载 普通下载 VIP

相关代码

								include "xmlbase.inc.php";//请填写你放置xmlbase文件的路径
				include "agentxmlclient.inc.php";//请填写你放置agentxmlclient.inc.php文件的路径
				//include "config.inc.php"; //请填写你放置config.inc.php文件的路径,这是配置文件
				
				class SMS extends XMLClient
				{
					var $ConfNull="1";
					function SMS()
					{
						if(file_exists("api/config.inc.php"))
							include "api/config.inc.php"; //请填写你放置config.inc.php文件的路径,这是配置文件
						else $this->ConfNull = "-1";
						$this->serverURL=$vcpserver.":".$vcpserverport;
						$this->XMLType="SMS";
						$this->VCP=$vcpuser;
						$this->VCPPassword=$vcppassword;
					}
					//发送SMS短信接口
					function sendSMS($mobile, $msg, $time="", $apitype=0)
					{
						$xml_command="SMS:sendSMS
										$mobile
										".base64_encode($msg)."
										$time
										$apitype";
						$this->sendSCPData($this->serverURL, $xml_command);
						$this->toPlain();
						return $this->responseXML;
					}
					//查询远程账户余额
					function infoSMSAccount()
					{
						$xml_command="SMS:infoSMSAccount";
						$this->sendSCPData($this->serverURL, $xml_command);
						$this->toPlain();
						return $this->responseXML;
					}
					//接收SMS短信接口
					function readSMS()
					{
						$xml_command="SMS:readSMS";
						$this->sendSCPData($this->serverURL, $xml_command);
						$this->toPlain();
						return $this->responseXML;
					}
				
					function updateConf($username, $pass, $server){
						if(!file_exists("api/config.inc.php")) return "文件smsdemo/api/config.inc.php 不存在!";
						if(!is_writable("api/config.inc.php")) return "文件smsdemo/api/config.inc.php 不可写!请检查文件属性!";
						$fd = fopen("api/config.inc.php","w");
						if(!$fd) return "文件smsdemo/api/config.inc.php 打不开, 请检查文件属性!";
						$line = '								'/** '."\n".
								' * 这是配置文件 '.
								' * $'."vcpserver		SCP服务器地址,测试服务器为testxml.todaynic.com,正式服务器为xml.todaynic.com "."\n".
								' * $'."vcpserverport	SCP服务器,在测试环境和真实环境,使用的接口均为20001 "."\n".
								' * $'."vcpsuser		时代互联提供的真实短信用户或测试用户 "."\n".
								' * $'."vcppassword		 时代互联提供的真实短信用户密码或测试用户密码 "."\n".
								' * '."\n".
								' * www.now.com,Inc. http://www.now.com '."\n".
								'**/ '."\n".
								'$'.'vcpserver="'.$server.'"; '."\n".
								'$'.'vcpserverport="20001"; '."\n".
								'$'.'vcpuser="'.$username.'"; '."\n".
								'$'.'vcppassword="'.$pass.'"; '."\n".
								'?> '."\n";
						if(fwrite($fd, $line)===FALSE) return "文件smsdemo/api/config.inc.php 写入失败!请检查文件属性!";
						fclose($fd);
						return "1";
					}
				}
				
				?>			

相关资源