두명이상 문자(sms) 발송 방법

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
두명이상 문자(sms) 발송 방법

QA

두명이상 문자(sms) 발송 방법

본문

회원가입시 관리자와 가입회원 2명에게 각각 문자 보내고 싶습니다.
 $mb_hp 을 추가 하는 방법 알려 주시면 감사하겠습니다.
$SMS->Add(관리자, 가입회원, $config['cf_icode_id'], iconv_euckr(stripslashes($sms_contents)), "");
$SMS->Add(가입회원, 관리자, $config['cf_icode_id'], iconv_euckr(stripslashes($sms_contents)), "");

            

<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가

//----------------------------------------------------------
// SMS 문자전송 시작
//----------------------------------------------------------

$sms_contents = "[".$mb_name."] 님이 회원가입했습니다.";  // 문자 내용

// 핸드폰번호에서 숫자만 취한다
$receive_number = preg_replace("/[^0-9]/", "", $sms5['cf_phone']);  // 수신자번호
$send_number = preg_replace("/[^0-9]/", "", $sms5['cf_phone']); // 발신자번호

if ($w == "" && $receive_number)
{
    if ($config['cf_sms_use'] == 'icode')
    {
        if($config['cf_sms_type'] == 'LMS') {
            include_once(G5_LIB_PATH.'/icode.lms.lib.php');

            $port_setting = get_icode_port_type($config['cf_icode_id'], $config['cf_icode_pw']);

            // SMS 모듈 클래스 생성
            if($port_setting !== false) {
                $SMS = new LMS;
                $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $port_setting);

                $strDest     = array();
                $strDest[]   = $receive_number;
                $strCallBack = $send_number;
                $strCaller   = iconv_euckr(trim($config['cf_title']));
                $strSubject  = '';
                $strURL      = '';
                $strData     = iconv_euckr($sms_contents);
                $strDate     = '';
                $nCount      = count($strDest);

                $res = $SMS->Add($strDest, $strCallBack, $strCaller, $strSubject, $strURL, $strData, $strDate, $nCount);

                $SMS->Send();
                $SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
            }
        } else {
            include_once(G5_LIB_PATH.'/icode.sms.lib.php');

            $SMS = new SMS; // SMS 연결
            $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']);
            $SMS->Add($receive_number, $send_number, $config['cf_icode_id'], iconv_euckr(stripslashes($sms_contents)), "");
            $SMS->Send();
            $SMS->Init(); // 보관하고 있던 결과값을 지웁니다.
        }
    }
}
//----------------------------------------------------------
// SMS 문자전송 끝
//----------------------------------------------------------
?>
 

 

이 질문에 댓글 쓰기 :

답변 3

SIR 검색을 하면 많은 팁들이 존재합니다.

 

아래의 함수를 적당한 위치에 추가해 주거나 공통함수 파일에 넣어주셔도 됩니다.


// 문자 발송 함수 (보내는번호, 받는번호, 메세지)
function smsSend($sHp, $rHp, $msg) {
    global $config;
    
    $rtn = "";
    try {
        $send_hp = str_replace("-","",$sHp); // - 제거 
        $recv_hp = str_replace("-","",$rHp); // - 제거         
        $SMS = new SMS; // SMS 객체 생성
        $SMS->SMS_con($config['cf_icode_server_ip'], 
                                    $config['cf_icode_id'], 
                                    $config['cf_icode_pw'], 
                                    $config['cf_icode_server_port']); 
        $SMS->Add($recv_hp, 
                            $send_hp, 
                            $config['cf_icode_id'], 
                            iconv("utf-8", "euc-kr", stripslashes($msg))
                            , ""); 
        $SMS->Send(); 
        $rtn = true;
    } catch(Exception $e) {
        alert("처리중 문제가 발생했습니다.".$e->getMessage());
        $rtn = false;
    }
    
    return $rtn;
}

 

업데이트 파일에 아래의 코드를 참고하세요.


include_once(G5_LIB_PATH.'/icode.sms.lib.php');
 
$send_number = "*** 개인정보보호를 위한 휴대폰번호 노출방지 ***"; // 보내는번호 (사전등록된 번호)
$recv_numberA = "*** 개인정보보호를 위한 휴대폰번호 노출방지 ***"; // 받는 번호1
$recv_numberB = "*** 개인정보보호를 위한 휴대폰번호 노출방지 ***"; // 받는번호2
 
$sms_msg = "문자내용1\r\n";
$sms_msg .= "문자내용2\r\n";
$sms_msg .= "문자내용3\r\n";
$sms_msg .= "문자내용4\r\n";
$sms_msg .= "문자내용5";
 
smsSend($send_number, $recv_numberB, $sms_msg);
smsSend($send_number, $recv_numberA, $sms_msg);

 

 위쪽 LMS로 보낼때               

$strDest[]   = $receive_number;

$strDest[]   = $receive_number2; <---이것처럼 수신번호를 추가하면 됩니다

 

아래쪽 단문으로 보낼때

$SMS->Add($receive_number~~~);

$SMS->Send();

$SMS->Add($receive_number2~~~); <---이것 처럼 두번 반복하면 됩니다

$SMS->Send();

 

 

 

답변을 작성하시기 전에 로그인 해주세요.
전체 0
QA 내용 검색
  • 개별 목록 구성 제목 답변작성자조회작성일
  • 질문이 없습니다.

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT