首页 > 其他 > 详细

短信宝发送短信

时间:2021-09-03 21:56:24      阅读:16      评论:0      收藏:0      [点我收藏+]

        $phone = $request[‘phone‘];
        $statusStr = array(
            "0" => "短信发送成功",
            "-1" => "参数不全",
            "-2" => "服务器空间不支持,请确认支持curl或者fsocket.",
            "30" => "密码错误",
            "40" => "账号不存在",
            "41" => "余额不足",
            "42" => "帐户已过期",
            "43" => "IP地址限制",
            "50" => "内容含有敏感词"
        );


        $rand = rand(1000,9999);
        $content= "【阿果2021.,欢迎您登录阿果平台,您的验证码为".$rand;

 

$smsapi = "http://api.smsbao.com/";
$user = "******";
$pass = md5("******");
$sendurl = $smsapi."sms?u=".$user."&p=".$pass."&m=".$phone."&c=".urlencode($content);

$res = file_get_contents($sendurl);
    if($res==0){
     Cache::put($phone,$rand,180);
return [‘code‘=>200,‘data‘=>$rand,‘msg‘=>$statusStr[$res]];
}else{
return [‘code‘=>$res,‘data‘=>‘‘,‘msg‘=>$statusStr[$res]];

}

短信宝发送短信

原文:https://www.cnblogs.com/aguo/p/15221538.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!