本帖最后由 hehu158 于 2014-10-24 09:09
1、備份網站根目錄下phpcms\modules\sms\classes\smsapi.class.php
如果此前沒有修改過該文件,直接把phpcms文件夾復制到根目錄下覆蓋即可;如果之前修改過,需要替換其中send_sms函數的執行代碼:
//短信發送狀態
$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);//官網IS GBK
}else{
$send_content = $content;
}
$send_time = strtotime($send_time);
$target = "http://sms.106jiekou.com/utf8/sms.aspx";
$sms_template="您的驗證碼是:【變量】。請不要把驗證碼泄露給其他人。如非本人操作,可不用理會!";
$send_content=str_replace("【變量】",$send_content,$sms_template);
//替換成自己的測試賬號,參數順序和wenservice對應
$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);
//增加到本地數據庫
$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、打開http://www.699199.cn網站注冊賬號,后臺配置接口設置
綁定ip(選填)可以填寫自己網站的ip地址,保證你在調用短信接口時的安全性,不懂的可以咨詢在線客服; ![]()
圖1-1 接口設置
3、phpcms后臺設置
模塊(頂端)—短信平臺(左側)—平臺設置,輸入你在短信通平臺中注冊的賬號跟密碼(接口設置中的接口密碼,注意不是賬號的登陸密碼)。
![]()
圖1-2 phpcms后臺短信通短信接口設置
二、個性化設置(***非必要***) |