PHP集成华为企业信息机
来源:互联网 发布:腾讯nba数据 编辑:程序博客网 时间:2024/05/18 03:18
华为信息机虽然只提供了DLL和Java的接口,但是其它的语言还是可以调用,方法就是使用它的存储过程。下面是一个PHP调用的例子
class PHPSMS {
var $dbHost = "ip:1433";
var $dbName = "DB_CustomSMS";
var $dbUser = "sa";
var $dbPass = "";
var $name = "0005";
var $pass = "";
var $db;
function init() {
$this->db = &ADONewConnection('mssql');
$this->db->Connect($this->dbHost,$this->dbUser,$this->dbPass,$this->dbName) or die($db->ErrorMsg().'
');
}
function addSMtoSend($pDestAddr,$pSmContent) {
$pOrgAddr = '1068×××××'.$this->name;
$pSendTime = date("Y-m-d H:i:s");
$pNeedStateReport = 0;
$pServiceID = "EIES";
$pFeeType = "02" ;
$pFeeCode = "0";
$pSMType = 0;
$pMessageID = "0";
$pDestaddrType = 0;
$pCreatorID = $this->name;
$pSuccess = -1;
$stmt = $this->db->PrepareSP('addSMtoSend');
$this->db->InParameter($stmt,$pOrgAddr,'pOrgAddr');
$this->db->InParameter($stmt,$pDestAddr,'pDestAddr');
$this->db->InParameter($stmt,$pSmContent,'pSmContent');
$this->db->InParameter($stmt,$pSendTime,'pSendTime');
$this->db->InParameter($stmt,$pNeedStateReport,'pNeedStateReport');
$this->db->InParameter($stmt,$pServiceID,'pServiceID');
$this->db->InParameter($stmt,$pFeeType,'pFeeType');
$this->db->InParameter($stmt,$pFeeCode,'pFeeCode');
$this->db->InParameter($stmt,$pSMType,'pSMType');
$this->db->InParameter($stmt,$pMessageID,'pMessageID');
$this->db->InParameter($stmt,$pDestaddrType,'pDestaddrType');
$this->db->InParameter($stmt,$pCreatorID,'pCreatorID');
$this->db->OutParameter($stmt,$pSuccess,'pSuccess');
$this->db->Execute($stmt);
if($pSuccess>=0) return 1;
else return 0;
}
function fetchSMRequest(&$SourceAddr,&$Content,&$RecvTime) {
$DestAddrMask = '1068×××××'.$this->name;
$DestAddr = '';
$SMType = 0;
$pMessageID = "0";
$OrgAddrType = 0;
$ActionID = 0;
$ActionReasonID = 0;
$ServiceID = "";
$Ret_Code = 0;
$stmt = $this->db->PrepareSP('FetchSMRequest');
$this->db->InParameter($stmt,$DestAddrMask,'DestAddrMask');
$this->db->OutParameter($stmt,$SourceAddr,'SourceAddr');
$this->db->OutParameter($stmt,$DestAddr,'DestAddr');
$this->db->OutParameter($stmt,$Content,'Content');
$this->db->OutParameter($stmt,$RecvTime,'RecvTime');
$this->db->OutParameter($stmt,$SMType,'SMType');
$this->db->OutParameter($stmt,$MessageID,'MessageID');
$this->db->OutParameter($stmt,$OrgAddrType,'OrgAddrType');
$this->db->OutParameter($stmt,$ActionID,'ActionID');
$this->db->OutParameter($stmt,$ActionReasonID,'ActionReasonID');
$this->db->OutParameter($stmt,$ServiceID,'ServiceID');
$this->db->OutParameter($stmt,$Ret_Code,'Ret_Code');
$this->db->Execute($stmt);
return $Ret_Code; //0 没有消息 1 成功 -1 失败
}
}
?>
使用的时候,先初始化
$sms = new PHPSMS();
$sms->init();
发送消息的方法
$re = $sms->addSMtoSend('1385×××××','PHP测试');
if($re = 1) echo "success";
else echo "fail";
接收消息的方法
$SourceAddr = '';
$Content = '';
$RecvTime = '';
while( $sms->fetchSMRequest($SourceAddr,$Content,$RecvTime) ) {
echo $SourceAddr."
".$Content."
".$RecvTime;
}
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1632824
- PHP集成华为企业信息机
- PHP集成华为企业信息机
- PHP集成华为企业信息机
- PHP集成华为企业信息机
- PHP集成华为企业信息机
- PHP集成华为企业信息机
- PHP集成华为企业信息机
- PHP集成华为企业信息机
- PHP集成华为企业信息机
- PHP集成华为企业信息机
- PHP集成华为企业信息机
- PHP集成华为企业信息机
- PHP集成华为企业信息机
- PHP集成华为企业信息机
- PHP集成华为企业信息机
- PHP集成华为企业信息机
- PHP集成华为企业信息机
- PHP集成华为企业信息机 .
- Google Calendar免费手机提醒功能试用
- 免费的Scrum 和 XP 最佳实践的电子书下载
- 纪念2007年七月之梅雨
- 《麦肯锡卓越工作方法》
- 《越狱》第二季过后,剧情跌宕起伏,各角色们的命运也各有不同,现公布如下
- PHP集成华为企业信息机
- Google Maps开始支持360度全景街道风光了
- 测试效率
- 聖殿祭司的ASP.NET 2.0--使用C# /2e小改版
- Steve Yegge 将 Rails 移植到 Javascript/Rhino
- 关于csdn博客的一个小问题
- 一个真正符合中国国情的工作流设计参考(包括PHP实现)
- 一个不错的介绍企业应用集成和ESB的PPT
- 程序员的6大健康食品