Home > Backend Development > PHP Tutorial > 大家哪位高手写过php调用短信接口吗

大家哪位高手写过php调用短信接口吗

WBOY
Release: 2016-06-13 13:38:20
Original
1042 people have browsed it

大家谁写过php调用短信接口吗?
大家谁写过php调用短信接口吗,有源码最好,有适合的短信接口也推荐一下,要求:24小时发送,随发随到的,做验证码用的.

------解决方案--------------------
核心代码如下:

function rstr($str){
 $s=intval(substr($str,0,1));
 if($s==1)
$error='代表发送成功';
 else{
$b=intval(substr($str,0,2));
switch($b){
case -1:$error='手机号码不正确';break;
case -2:$error='除时间外,所有参数不能为空';break;
case -3:$error='用户名密码不正确';break;
case -4:$error='平台不存在';break;
case -5:$error='客户短信数量为0';break;
case -6:$error='客户账户余额小于要发送的条数';break;
case -7:$error='不能超过70个字';break;
case -8:$error='非法短信内容';break;
case -9:$error='未知系统故障';break;
case -10:$error='网络性错误';break;
default:$error=false;

 }
 return $error;
}

function sendnote($mobtel,$msg){
 $string = file_get_contents("http://jiekou.56dxw.com/sms/HttpInterface.aspx?comid=60&username=test1&userpwd=123&handtel=$mobtel&sendcontent=$msg&
sendtime=&smsnumber=0739");
 return rstr($string);
}
$msg='内容限制为70个字,';
$msg=mb_convert_encoding($msg, 'gb2312' ,'utf-8');
echo sendnote('手机号',$msg);

56短信接口文档下载地址:

http://www.56dxw.com/Interface/duanxinjiekouxiazai.html

php调用http短信接口源码:http://www.56dxw.com/Interface/202.html

短信接口请参考:http://www.56dxw.com

Related labels:
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template