• 4001-021-502
您的位置:短信宝 > 技术分享 > ThinkLC分类信息系统新增短信宝短信接口
ThinkLC分类信息系统新增短信宝短信接口
发表日期:2018-06-01    文章编辑:短信宝小编    浏览次数:

ThinkLC是一款基于PHP+MYSQL开发的地方分类信息系统,完全面向对象的技术架构设计开发。便于二次开发,小编对于这款软件还是比较了解的,我们今天讲的是ThinkLC_3.8版本。使用的短信接口是我们短信宝短信群发平台的接口,我们短信宝短信群发平台非常稳定,发送速度快,注册还送测试短信,推荐大家使用。

我们需要在项目根目录SaxueFrame\source\sms文件中创建一个名为smsbao.php的php文件,代码如下:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
header("Content-type:text/html;charset:UTF-8");
 
/**
* 短信宝短信接口
*/
class saxuesms extends saxueobject
{
    
    protected $statusStr array(
        "0" => "短信发送成功",
        "-1" => "参数不全",
        "-2" => "服务器空间不支持,请确认支持curl或者fsocket,联系您的空间商解决或者更换空间!",
        "30" => "密码错误",
        "40" => "账号不存在",
        "41" => "余额不足",
        "42" => "帐户已过期",
        "43" => "IP地址限制",
        "50" => "内容含有敏感词"
    );
 
    protected $uid     '';
    protected $pass    '';
    protected $sign    '';
    protected $mobile  '';
    protected $content '';
 
    public function __construct($mobile,$content,$iscode=true)
    {
        $this->mobile = $mobile;
        if (empty($mobile)) {
            $this->raiseerror('手机号码不能为空',SAXUE_ERROR_RETURN);
        }
 
        if ($iscode) {
            $this->content = '【'.$this->sign.'】您的验证码为:'.$content.'(10分钟内有效)';
        }else{
            $this->content = $content;
        }
    }
 
 
    public function sendsms()
    {
        $url 'http://api.smsbao.com/sms?u='.$this->uid.'&p='.md5($this->pass).'&m='.$this->mobile.'&c='.$this->content;
        $ret $this->SmsPost($url);
        if ($ret != 0) {
            $this->raiseerror('错误代码:'.$this->statusStr[$ret],SAXUE_ERROR_RETURN);
        }
 
    }
 
 
    protected function SmsPost($url)
    {
        if (function_exists('file_get_contents')){
            $file_contents file_get_contents($url);
        }else{
            $ch = curl_init();
            $timeout = 5;
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
            $file_contents = curl_exec($ch);
            curl_close($ch);
        
        return $file_contents;
    }
 
 
}

好了,经过以上的创建,短信宝的短信平台已经替换成功了,可以正常使用了。进行发送测试:


报备一下短信宝的VIP模板,这样就可以走短信宝的优质通道了,即便遇到敏感文字我们都不会人工审核,短信内容3~5秒就可送达。

另外:我们已经开发好完整的ThinkLC分类信息系统短信宝插件,点击此链接 下载及查看安装流程。

短信宝-做更好用的短信验证码短信营销短信群发服务平台。超过9,000个网站始终信任短信宝。通过稳定快捷的短信,短信宝帮助他们缩短了90%的人工服务处理时间,同时降低了81%由于通讯故障导致的废单率,一切变得轻松可控!

Copyright © 2010-2014 smsbao.com All Rights Reserved
上海子橙电子科技有限公司 沪ICP备14008182号-2 上海市松江区广富林路658弄215号

展开