혹시 Cafe24에서 SMS 호스팅과 그누를 연동해보신분 계신가요? ㄷㄷㄷ

· 14년 전 · 3031 · 3
청약서 스킨을 만들고 쫑났다고 생각했는뎁 ...ㅠ.ㅠ
이걸 글쓰기 완료하면 자동으로 관리자 핸드폰 문자로 보내게 해달라네요 ;;;
네이버랑 그누랑 찾다가 이거다~! 한게 SMS 호스팅과 연동 !!!
근데 이거 6처넌짜리 신청 하구 나서 보니 ;;;
어떤 방식으로 되는지는 알겠는데
글쓰기 완료하면 자동으로 관리자에게 문자 오게 하는 방법이 어렵네요 쩝 ;;;
이런거 해보신분 있으심 간략하게라두 방법좀 알려주세요 ;;;

//추가 사항
게시판 글쓰기 확인하면 자동으로 문자 관리자에게 넘어오게 하려고 합니다
값을 value로 미리 주고 폼을 hidden 시키려구요 ^^;;;
샘플 소스도 올릴게요

샘플 소스는 4개 입니다
============================================ sendform.html ===========================
<form method="post" action="<?=$g4[path]?>/sms_test/smssend.php">
<input type="hidden" name="action" value="go">
전송메세지
<TEXTAREA NAME="msg" ROWS="" COLS="">테스트 전송</TEXTAREA>
<!-- <input type="text" name="msg" maxlength="80" size=80> --> 예)80byte 이하로 입력.
<br>받는 번호 <input type="text" name="rphone" value="010-2222-1234"> 예) 011-012-1234 , '-' 포함해서 입력.
<br>받는 번호&이름 <input type="text" name="destination" value="010-1111-1234|홍길동" size=80> 예) 010-000-0000|홍길동
<br>
보내는 번호<input type="text" name="sphone1" maxlength="4" value="010">-
<input type="text" name="sphone2" maxlength="4" value="1111">-
<input type="text" name="sphone3" maxlength="4" value="1111">
<br>예약 날짜 <input type="text" name="rdate" maxlength="8"> 예)20090909
<br>예약 시간 <input type="text" name="rtime" maxlength="6"> 예)173000 ,오후 5시 30분,예약시간은 최소 10분 이상으로 설정.
<br>return url <input type="text" name="returnurl" maxlength="64" value="http://jhtest0025.cafe24.com/sms/send01.html" >
<br> test flag <input type="text" name="testflag" maxlength="1" value="Y"> 예) 테스트시: Y
<br>nointeractive <input type="text" name="nointeractive" maxlength="1"> 예) 사용할 경우 : 1, 성공시 대화상자(alert)를 생략.
<br>반복설정 <input type="checkbox" name="repeatFlag" value="Y">
<br> 반복횟수 <select name="repeatNum">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select> 예) 1~10회 가능.
<br>전송간격<select name="repeatTime"> 예)15분 이상부터 가능.
<option value="15">15</option>
<option value="20">20</option>
<option value="25">25</option>
</select>분마다
<br>
<input type="submit" value="전송" accesskey='s'>
</form>

여기서 값을 넘기는 파일인 smssend.php 파일은
============================================ smssend.php ===========================
<?
if($_POST['action']=='go'){

/******************** 인증정보 ********************/
$sms_url = "http://sslsms.cafe24.com/sms_sender.php"; // 전송요청 URL
// $sms_url = "https://sslsms.cafe24.com/sms_sender.php"; // HTTPS 전송요청 URL
$sms['user_id'] = base64_encode("아이디"); //SMS 아이디.
$sms['secure'] = base64_encode("cafe24에서 준 인증키값") ;//인증키
$sms['msg'] = base64_encode(stripslashes($_POST['msg']));

$sms['rphone'] = base64_encode($_POST['rphone']);
$sms['sphone1'] = base64_encode($_POST['sphone1']);
$sms['sphone2'] = base64_encode($_POST['sphone2']);
$sms['sphone3'] = base64_encode($_POST['sphone3']);
$sms['rdate'] = base64_encode($_POST['rdate']);
$sms['rtime'] = base64_encode($_POST['rtime']);
$sms['mode'] = base64_encode("1"); // base64 사용시 반드시 모드값을 1로 주셔야 합니다.
$sms['returnurl'] = base64_encode($_POST['returnurl']);
$sms['testflag'] = base64_encode($_POST['testflag']);
$sms['destination'] = urlencode(base64_encode($_POST['destination']));
$returnurl = $_POST['returnurl'];
$sms['repeatFlag'] = base64_encode($_POST['repeatFlag']);
$sms['repeatNum'] = base64_encode($_POST['repeatNum']);
$sms['repeatTime'] = base64_encode($_POST['repeatTime']);
$nointeractive = $_POST['nointeractive']; //사용할 경우 : 1, 성공시 대화상자(alert)를 생략

$host_info = explode("/", $sms_url);
$host = $host_info[2];
$path = $host_info[3]."/".$host_info[4];

srand((double)microtime()*1000000);
$boundary = "---------------------".substr(md5(rand(0,32000)),0,10);
//print_r($sms);

// 헤더 생성
$header = "POST /".$path ." HTTP/1.0\r\n";
$header .= "Host: ".$host."\r\n";
$header .= "Content-type: multipart/form-data, boundary=".$boundary."\r\n";

// 본문 생성
foreach($sms AS $index => $value){
$data .="--$boundary\r\n";
$data .= "Content-Disposition: form-data; name=\"".$index."\"\r\n";
$data .= "\r\n".$value."\r\n";
$data .="--$boundary\r\n";
}
$header .= "Content-length: " . strlen($data) . "\r\n\r\n";

$fp = fsockopen($host, 80);

if ($fp) {
fputs($fp, $header.$data);
$rsp = '';
while(!feof($fp)) {
$rsp .= fgets($fp,8192);
}
fclose($fp);
$msg = explode("\r\n\r\n",trim($rsp));
$rMsg = explode(",", $msg[1]);
$Result= $rMsg[0]; //발송결과
$Count= $rMsg[1]; //잔여건수

//발송결과 알림
if($Result=="success") {
$alert = "성공";
$alert .= " 잔여건수는 ".$Count."건 입니다.";
}
else if($Result=="reserved") {
$alert = "성공적으로 예약되었습니다.";
$alert .= " 잔여건수는 ".$Count."건 입니다.";
}
else if($Result=="3205") {
$alert = "잘못된 번호형식입니다.";
}

else if($Result=="0044") {
$alert = "스팸문자는발송되지 않습니다.";
}

else {
$alert = "[Error]".$Result;
}
}
else {
$alert = "Connection Failed";
}

if($nointeractive=="1" && ($Result!="success" && $Result!="Test Success!" && $Result!="reserved") ) {
echo "<script>alert('".$alert ."')</script>";
}
else if($nointeractive!="1") {
echo "<script>alert('".$alert ."')</script>";
}
echo "<script>location.href='".$returnurl."';</script>";
}
?>
요 파일에서 그담 잔여 건수조회로 넘어갑니다

============================================ smscount.php ===========================
<?
$sms_url = "http://sslsms.cafe24.com/sms_remain.php"; // SMS 잔여건수 요청 URL
$sms['user_id'] = base64_encode("SMS 아이디"); // SMS 아이디
$sms['secure'] = base64_encode("인증키") ;//인증키

$sms['mode'] = base64_encode("1"); // base64 사용시 반드시 모드값을 1로 주셔야 합니다.

$host_info = explode("/", $sms_url);
$host = $host_info[2];
$path = $host_info[3]."/".$host_info[4];
srand((double)microtime()*1000000);
$boundary = "---------------------".substr(md5(rand(0,32000)),0,10);

// 헤더 생성
$header = "POST /".$path ." HTTP/1.0\r\n";
$header .= "Host: ".$host."\r\n";
$header .= "Content-type: multipart/form-data, boundary=".$boundary."\r\n";

// 본문 생성
foreach($sms AS $index => $value){
$data .="--$boundary\r\n";
$data .= "Content-Disposition: form-data; name=\"".$index."\"\r\n";
$data .= "\r\n".$value."\r\n";
$data .="--$boundary\r\n";
}
$header .= "Content-length: " . strlen($data) . "\r\n\r\n";

$fp = fsockopen($host, 80);

if ($fp) {
fputs($fp, $header.$data);
$rsp = '';
while(!feof($fp)) {
$rsp .= fgets($fp,8192);
}
fclose($fp);
$msg = explode("\r\n\r\n",trim($rsp));
$Count = $msg[1]; //잔여건수
echo $Count;
}
else {
echo "Connection Failed";
}
?>
그담 결과 값이 나오는데요
============================================ smsresult.php ===========================
<?PHP
$sms_url = "http://smsapi.cafe24.com/sms_list.php"; // 전송요청 URL
$sms['user_id'] = ""; // SMS 아이디
$sms['secure'] = "" ;//인증키
$sms['date'] = "" ;//조회 기준일
$sms['day'] = "1" ;//조회 범위
$sms['startNo'] = "0" ;//조회 시작번호
$sms['displayNo'] = "10" ;//출력 갯수
$sms['sendType'] = "" ;//발송형태
$sms['sendStatus'] = "" ;//발송상태
$sms['receivePhone'] = "" ;//검색할 수신번호
$sms['sendPhone'] = "" ;//검색할 발신번호

$host_info = explode("/", $sms_url);
$host = $host_info[2];
$path = $host_info[3]."/".$host_info[4];
srand((double)microtime()*1000000);
$boundary = "---------------------".substr(md5(rand(0,32000)),0,10);

// 헤더 생성
$header = "POST /".$path ." HTTP/1.0\r\n";
$header .= "Host: ".$host."\r\n";
$header .= "Content-type: multipart/form-data, boundary=".$boundary."\r\n";

// 본문 생성
foreach($sms AS $index => $value){
$data .="--$boundary\r\n";
$data .= "Content-Disposition: form-data; name=\"".$index."\"\r\n";
$data .= "\r\n".$value."\r\n";
$data .="--$boundary\r\n";
}
$header .= "Content-length: " . strlen($data) . "\r\n\r\n";

$fp = fsockopen($host, 80);

if ($fp) {
fputs($fp, $header.$data);
$rsp = '';
while(!feof($fp)) {
$rsp .= fgets($fp,8192);
}
fclose($fp);
$msg = explode("\r\n\r\n",trim($rsp));
echo $msg[1];
}
else {
echo "Connection Failed";
}
?>
|

댓글 3개

보내기 방식을 안다면 write_update.skin.php 를 만들어서 스킨폴더에....
아래 처럼 넣으면 됩니다
if(!$w){
sms보내기
}
균이님 방금 샘플 소스 같이 올려 봤는데요
if(!$w){
sms보내기
}
에서 "sms보내기" 부분은 어느 부분을 넣어야 되나요 ㅎ
초보라 죄송합니다 ㅠ.ㅠ
smssend.php 내용 채워서 하시면 됩니다.
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
14년 전 조회 1,525
14년 전 조회 973
14년 전 조회 1,524
14년 전 조회 961
14년 전 조회 1,954
14년 전 조회 1,543
14년 전 조회 964
14년 전 조회 928
14년 전 조회 1,187
14년 전 조회 3,032
14년 전 조회 1,667
14년 전 조회 2,529
14년 전 조회 1,160
14년 전 조회 2,598
14년 전 조회 970
14년 전 조회 2,101
14년 전 조회 809
14년 전 조회 1,572
14년 전 조회 1,037
14년 전 조회 969