当前位置:网站首页>PHP SMS notification + voice broadcast automatic double call
PHP SMS notification + voice broadcast automatic double call
2022-06-24 11:14:00 【Sky breaking】
In some important information notification scenarios , Need users to receive and pay attention to information , Use SMS + Synchronous push of voice notification , Can solve this problem well .
Scene one : SMS notification with the same content + Voice notification is sent synchronously
While pushing text messages , Synchronously push voice notifications of the same content ; After the user receives the notification on the phone , You can also check the SMS to confirm the content of the message .
Field of application :
The freight driver informed 、 Express Logistics notification 、 Early warning notice of IOT equipment 、 Server monitoring alert notification 、 Important order information change notice .
Example notification template :
【 Mutual Wireless 】 honorific *** user , Hello! , Your available balance is 6358 strip , Please renew in time , For self-service renewal, please log in to the user center !
【 Mutual Wireless 】 honorific *** user , Hello! , Your account has reached the maximum sending amount you set , The system has paused sending , If you need to change , Please log in to the user center to operate !
【** Petrifaction 】 Your car number ***, Please visit *** Before entering the factory , Please wear safety helmet correctly 、 Reflective vest , Follow the command of on-site personnel , Thank you for your cooperation !
// Interface type : Wireless voice notification interface .
// Account registration : Please open an account through this address http://user.ihuyi.com/?exClaO
// matters needing attention :
//(1) During commissioning , Please read the interface documentation carefully ;
//(2) Please use APIID( see APIID Please log in to the user center -> Voice notification -> Account and signature settings ->APIID) And APIkey To call the interface ;
//(3) This code is only for reference when accessing the wireless voice notification interface , Customers can write their own according to their actual needs ;
// Turn on SESSION
session_start();
header("Content-type:text/html; charset=UTF-8");
// Request data to SMS interface , Check the environment for Turn on curl init.
function Post($curlPost,$url){
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_NOBODY, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost);
$return_str = curl_exec($curl);
curl_close($curl);
return $return_str;
}
// take xml Convert data to array format .
function xml_to_array($xml){
$reg = "/<(\w+)[^>]*>([\\x00-\\xFF]*)<\\/\\1>/";
if(preg_match_all($reg, $xml, $matches)){
$count = count($matches[0]);
for($i = 0; $i < $count; $i++){
$subxml= $matches[2][$i];
$key = $matches[1][$i];
if(preg_match( $reg, $subxml )){
$arr[$key] = xml_to_array( $subxml );
}else{
$arr[$key] = $subxml;
}
}
}
return $arr;
}
//random() Function returns a random integer .
function random($length = 6 , $numeric = 0) {
PHP_VERSION < '4.2.0' && mt_srand((double)microtime() * 1000000);
if($numeric) {
$hash = sprintf('%0'.$length.'d', mt_rand(0, pow(10, $length) - 1));
} else {
$hash = '';
$chars = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789abcdefghjkmnpqrstuvwxyz';
$max = strlen($chars) - 1;
for($i = 0; $i < $length; $i++) {
$hash .= $chars[mt_rand(0, $max)];
}
}
return $hash;
}
// SMS interface address
$target = "http://106.ihuyi.com/webservice/sms.php?method=Submit";
// Get cell phone number
$mobile = $_POST['mobile'];
// Get verification code
$send_code = $_POST['send_code'];
// Generated random number
$mobile_code = random(4,1);
if(empty($mobile)){
exit(' Mobile number cannot be empty ');
}
// Protect users from malicious requests
if(empty($_SESSION['send_code']) or $send_code!=$_SESSION['send_code']){
exit(' request timeout , Please refresh the page and try again ');
}
$post_data = "account= user name &password= password &mobile=".$mobile."&content=".rawurlencode(" Your verification code is :".$mobile_code.". Please don't leak the CAPTCHA to others .");
// View user name Log in to the user center -> Verification code notification SMS > Product overview ->API Interface information ->APIID
// Check the password Log in to the user center -> Verification code notification SMS > Product overview ->API Interface information ->APIKEY
$gets = xml_to_array(Post($post_data, $target));
if($gets['SubmitResult']['code']==2){
$_SESSION['mobile'] = $mobile;
$_SESSION['mobile_code'] = $mobile_code;
}
echo $gets['SubmitResult']['msg'];
边栏推荐
- SwiftUI Swift 内功之 Swift 中的属性观察者 didSet 与 willSet
- Why use a firewall? What is the function of firewall?
- What characteristics should a good design website have?
- When the data security law comes, how can enterprises prepare for a rainy day? Tencent security has something to say
- Several stacks of technology sharing: product managers' Online Official answers to several stacks of knowledge
- Influence of DEX optimization on arouter lookup path
- [Qianfan 618 countdown!] IAAs operation and maintenance special preferential activities
- 2D 照片变身 3D 模型,来看英伟达的 AI 新“魔法”!
- "Write once, run at all ends", Qualcomm released AI software stack!
- Moving Tencent to the cloud cured their technical anxiety
猜你喜欢
[IEEE publication] International Conference on natural language processing and information retrieval in 2022 (ecnlpir 2022)
Rising bubble canvas breaking animation JS special effect
喜歡就去行動
喜欢就去行动
“一次编写,运行各端”,高通重磅发布 AI 软件栈!
Shell脚本(.sh文件)如何执行完毕之后不自动关闭、闪退?
Canvas falling ball gravity JS special effect animation
Fashionable pop-up mode login registration window
如何开发短信通知和语音功能医院信息系统(HIS系统)
把腾讯搬到云上,治愈了他们的技术焦虑
随机推荐
System design: load balancing
Cause analysis of frequent crash and restart of easynvr-arm cloud terminal
MYSQL_精讲数据库数据类型
【本周六活动】.NET Day in China
脚本之美│VBS 入门交互实战
Why are some old SEO methods still effective?
What is the bin file for? How to open the file correctly
腾讯开源项目「应龙」成Apache顶级项目:前身长期服务微信支付,能hold住百万亿级数据流处理...
How to export only the titles in word documents? (i.e. delete all the text contents and keep only the title) stop B
Preparation for a series of courses on WordPress applet generation
使用Process Monitor工具监测进程对注册表和文件的操作
Ppt drawing related, shortcut keys, aesthetics
Canvas falling ball gravity JS special effect animation
Base64 decoding method three ways for non professionals
“一次编写,运行各端”,高通重磅发布 AI 软件栈!
Influence of DEX optimization on arouter lookup path
Understanding of homogeneous coordinates
Disaster recovery series (II) -- enterprises' one-stop disaster recovery construction with the help of cloud platform?
P5.js paper crane animation background JS special effect
Can text pictures be converted to word? How to extract text from pictures