本帖最后由 hehu158 于 2014-10-24 09:09
1、備份網(wǎng)站根目錄下phpcms\modules\sms\classes\smsapi.class.php
如果此前沒(méi)有修改過(guò)該文件,直接把phpcms文件夾復(fù)制到根目錄下覆蓋即可;如果之前修改過(guò),需要替換其中send_sms函數(shù)的執(zhí)行代碼:
//短信發(fā)送狀態(tài)
$status = $this->_sms_status();
if(is_array($mobile)){
$mobile = implode(",", $mobile);
}
$content = safe_replace($content);
if(strtolower($charset)=='utf-8') {
$send_content = iconv('utf-8','gbk',$content);//官網(wǎng)IS GBK
}else{
$send_content = $content;
}
$send_time = strtotime($send_time);
$target = "http://sms.106jiekou.com/utf8/sms.aspx";
$sms_template="您的驗(yàn)證碼是:【變量】。請(qǐng)不要把驗(yàn)證碼泄露給其他人。如非本人操作,可不用理會(huì)!";
$send_content=str_replace("【變量】",$send_content,$sms_template);
//替換成自己的測(cè)試賬號(hào),參數(shù)順序和wenservice對(duì)應(yīng)
$data = "account=".$this->userid."&password=".$this->sms_key."&mobile=".$mobile."&content=".rawurlencode($send_content);
$url_info = parse_url($target);
$httpheader = "POST " . $url_info['path'] . " HTTP/1.0\r\n";
$httpheader .= "Host:" . $url_info['host'] . "\r\n";
$httpheader .= "Content-Type:application/x-www-form-urlencoded\r\n";
$httpheader .= "Content-Length:" . strlen($data) . "\r\n";
$httpheader .= "Connection:close\r\n\r\n";
//$httpheader .= "Connection:Keep-Alive\r\n\r\n";
$httpheader .= $data;
$fd = fsockopen($url_info['host'], 80);
fwrite($fd, $httpheader);
$gets = "";
while(!feof($fd)) {
$gets .= fread($fd, 128);
}
fclose($fd);
//增加到本地?cái)?shù)據(jù)庫(kù)
$sms_report_db = pc_base::load_model('sms_report_model');
$send_userid = param::get_cookie('_userid') ? intval(param::get_cookie('_userid')) : 0;
$ip = ip();
$new_content = $content;
if(strpos($gets, "100")) {
$sms_report_db->insert(array('mobile'=>$mobile,'posttime'=>SYS_TIME,'id_code'=>$new_content,'send_userid'=>$send_userid,'status'=>'100','msg'=>$send_content,'return_id'=>$gets,'ip'=>$ip));
} else {
$sms_report_db->insert(array('mobile'=>$mobile,'posttime'=>SYS_TIME,'send_userid'=>$send_userid,'status'=>'-2','msg'=>$new_content,'ip'=>$ip));
}
return $gets;
2、打開(kāi)http://www.aikep.cn網(wǎng)站注冊(cè)賬號(hào),后臺(tái)配置接口設(shè)置
綁定ip(選填)可以填寫(xiě)自己網(wǎng)站的ip地址,保證你在調(diào)用短信接口時(shí)的安全性,不懂的可以咨詢?cè)诰€客服; ![]()
圖1-1 接口設(shè)置
3、phpcms后臺(tái)設(shè)置
模塊(頂端)—短信平臺(tái)(左側(cè))—平臺(tái)設(shè)置,輸入你在短信通平臺(tái)中注冊(cè)的賬號(hào)跟密碼(接口設(shè)置中的接口密碼,注意不是賬號(hào)的登陸密碼)。
![]()
圖1-2 phpcms后臺(tái)短信通短信接口設(shè)置
二、個(gè)性化設(shè)置(***非必要***) |
友情鏈接:106短信平臺(tái) | 發(fā)短信平臺(tái) | 短信接口平臺(tái) | 短信接口平臺(tái)哪個(gè)好 | 國(guó)際短信 | 短信通 | 短信接口應(yīng)用
關(guān)于我們 | 產(chǎn)品與服務(wù) | 解決方案 | 客戶案例 | 聯(lián)系我們 | 幫助指南 | 付款方式
Copyright © 2008-2018 短信通 . 速度網(wǎng)絡(luò)有限公司 短信接口應(yīng)用第一平臺(tái) All rights reserved. 浙ICP備10040624號(hào)-2