Home > php教程 > php手册 > php写的短信接口(全网支持)

php写的短信接口(全网支持)

WBOY
Release: 2016-06-21 09:05:44
Original
1654 people have browsed it
  • 适用行业:金融、工商、税务、电力、贸易、商业、旅游、政府、邮政、教育等行业

    适用类型:挂接各种B/S系统,作为各类办公系统、ERP、CRM、电子商务平台的插件(如群发短信会议通知、会员/客户关系交流、订单生成通知、发货通知、日程提醒、催费通知等等)

    特 点: 绿色短信,合法正规通道,全网收发
    支持移动、联通、电信、网通短信,双向互动,可回复 高速群发

    免费帐号申请(请注明来自"ChinaUnix",赠送50条短信,测试短信不够用的话再联系我)
    QQ:670168401(申请帐号) QQ群:199217(短信接口应用交流)


    * 短信URL接口详细参数说明文件: Http://app.37du.net/短信URL接口参数说明.doc

    * 短信接口文件:

    /*根据参数,生成调用URL,因为是测试例子,不对变量为空的情况做处理*/

    $http = "http://interface.85521.com/interface_sms_url.ajax"; // 接口文件地址
    $LoginName = ""; // 短信帐号
    $pass = ""; // 短信帐号密码
    $Code = ""; // 业务代码,缺省为空
    $subid = ""; // 子号,缺省为空
    $sender = ""; // 发送号码
    $receivers = ""; // 接收号码,多个手机号以分号 ; 分隔
    $setTimer = ""; // 定时发送时间,格式:YYYY-MM-DD HH:MM ,即时发送则不需要
    $message = ""; // 短信内容
    $cmd = ""; // 操作命令,发送短信值为send,查询回复值为query,查询帐号短信余额为remain
    $allowForward = ""; // 转发支持,缺省为0
    $system = ""; // 应用平台,缺省为空(windows),其他平台值:unix或linux

    $url = $http."?LoginName=".$LoginName."&pass=".$pass."&Code=".$Code."&subid=".$subid."&sender=".$sender."&receivers=".$receivers."&setTimer=".$setTimer."&message=".urlencode($message)."&cmd=".$cmd."&allowForward=".$allowForward."&system=".$system;

    /* windows平台调用接口形式:MSXML,发送请求*/
    // ----------------------------------------------------------------------------
    $objHttpRequest=new COM("MSXML2.ServerXMLHTTP");
    if (is_null($objHttpRequest)) {
    echo "create Msxl2.ServerXMLHTTP error";
    exit();
    }
    $objHttpRequest->open("GET",$URL,False);
    $objHttpRequest->send();
    if ($objHttpRequest->status 200) {
    /*返回错误*/
    echo "open Request error";
    exit();
    }
    /*获取返回的信息*/
    $retMsg=$objHttpRequest->responseText;
    $objHttpRequest=NULL;
    // ----------------------------------------------------------------------------


    /* 通用调用用接口形式,(其他平台linux、unix)*/
    // ----------------------------------------------------------------------------
    $file = $http."?LoginName=".$LoginName."&pass=".$pass."&Code=".$Code."&subid=".$subid."&sender=".$sender."&receivers=".$receivers."&setTimer=".$setTimer."&message=".urlencode($message)."&cmd=".$cmd."&allowForward=".$allowForward."&system=".$system;
    $fp = fopen($file,"r");
    $retMsg = fgetss($fp); // $retMsg = fgetss($fp,1024);
    fclose($fp);
    // ----------------------------------------------------------------------------


    /* 根据返回的信息($retMsg,形式如下)获取相应的内容,参数含义请参考“短信接口参数说明”
    windows平台返回形式如下:


    -
    -


    -6





    其他平台返回形式如下:

    [SendSmsReport]
    [Summary]
    [Success][/Success]
    [Fail][/Fail]
    [RetCode]-6[/RetCode]
    [SmsRemain][/SmsRemain]
    [ErrPhones][/ErrPhones]
    [/Summary]
    [/SendSmsReport]

    */
    ?>


  • Related labels:
    gt
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Recommendations
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template