📄 sms.inc.php
字号:
<?
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="<action>SMS:sendSMS</action>
<sms:mobile>$mobile</sms:mobile>
<sms:message>".base64_encode($msg)."</sms:message>
<sms:datetime>$time</sms:datetime>
<sms:apitype>$apitype</sms:apitype>";
$this->sendSCPData($this->serverURL, $xml_command);
$this->toPlain();
return $this->responseXML;
}
//查询远程账户余额
function infoSMSAccount()
{
$xml_command="<action>SMS:infoSMSAccount</action>";
$this->sendSCPData($this->serverURL, $xml_command);
$this->toPlain();
return $this->responseXML;
}
//接收SMS短信接口
function readSMS()
{
$xml_command="<action>SMS:readSMS</action>";
$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".
'/** '."\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";
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -