如果本文对你有用,请爱心点个赞,提高排名,帮助更多的人。谢谢大家!❤
如果解决不了,可以在文末进群交流。
如果对你有帮助的话麻烦点个【推荐】~最好还可以follow一下我的GitHub~感谢观看!
<?php
$phone=$_POST["Tel"];
$authenCode=$_POST["authenCode"];
function send_msg($url,$mobile,$appkey,$msg) {
$cu = curl_init($url);
curl_setopt_array($cu, array(
CURLOPT_POSTFIELDS => http_build_query(array(
'msg' => $msg,
'phone' => $mobile,
'nationcode' => "86",
'sig' => md5($appkey.$mobile),
'type' => "0",
)),
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_HTTPHEADER => array(
'Host: yun.zhuimeng.qq.com'
)
));
$ret = curl_exec($cu);
if($ret === false)
print("error");
else {
$json = json_decode($ret);
if($json === false) print("error");
else print("ok");
}
}
send_msg("https://yun.zhui'meng.qq.com/v3/tlssmssvr/sendsms?sdkappid=5232136&type=post",$phone,"9fdcc2f0**********0c08642f6","【墜夢网络】".$authenCode."为您的手机号认证验证码,请于2分钟内填写。如非本人操作,请忽略本短信。");
exit();
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>SMS</title>
<script type="text/javascript">
</script>
</head>
<body>
</body>
</html>
生成短信验证码函数可以根据自己需要去写。
//生成短信验证码函数
function get_mobile_code(){
$forbidden_num = "1989:10086:12590:1259:10010:10001:10000:";
do
{
$mobile_code = substr(microtime(), 2, 6);
}
while (preg_match($mobile_code.':', $forbidden_num));
return $mobile_code;
}
废话不多说了,直接上代码,不懂地方可留言,或者进微信群内交流。群二维码如果过期,请加我微信:mengyilingjian.