灰儿 发表于 2024-6-21 14:27:08

Discuz! X3.5( dzx3.5)安装蒲宁手机注册登陆插件后,提示短信网关异常

Discuz! X3.5( dzx3.5)安装“蒲宁手机注册登陆 7.8.4 (pn_register)”插件后,用户进入设置->密码安全,点“手机验证码”的“发送”按钮时,提示“短信网关异常,请稍候再试。”



解决方法:
打开 /source/plugin/pn_register/smsgw/smsgw_dxb.php 文件,查找如下代码:
$smsinfo = array(
                        'username' => $_G['cache']['plugin']['pn_register']['username'],
                        'apikey' => $_G['cache']['plugin']['pn_register']['apikey'],
                        'mobile' => urlencode($mobile),
                        'content' => urlencode($content),
                );

                $url = $endpoint . $operation . '?u=' . $smsinfo['username'] . '&p=' . $smsinfo['apikey'] . '&m=' . $smsinfo['mobile'] . '&c=' . $smsinfo['content'];

                $params = array(
                        'url' => $url,
                        'method' => 'GET'
                );

                $client = filesock::open($params);
                $data = $client->request();
                if(!$data) {
                        $data = $client->filesockbody;
                }

                $result = json_decode($data);
替换为:
$smsinfo = array(
                        'username' => $_G['cache']['plugin']['pn_register']['dxb_username'],
                        'apikey' => md5($_G['cache']['plugin']['pn_register']['dxb_apikey']),
                        'mobile' => urlencode($mobile),
                        'content' => urlencode($content),
                );

                $url = $endpoint . $operation . '?u=' . $smsinfo['username'] . '&p=' . $smsinfo['apikey'] . '&m=' . $smsinfo['mobile'] . '&c=' . $smsinfo['content'];
               
                $result =file_get_contents($url) ;

页: [1]
查看完整版本: Discuz! X3.5( dzx3.5)安装蒲宁手机注册登陆插件后,提示短信网关异常