개발자 포럼
필독사항1 : | |
---|---|
필독사항2 : |
MessageXE 기본모듈 mobilemessage.controller.php의 sendMessage메소드를 이용하여 간단히 문자를 발송하는 애드온 예제입니다.
MessageXE 기본모듈이 설치된 상태에서 아래와 같이 간단히 mobilemessage controller 의 sendMessage 메소드 호출로 SMS(80바이트) 혹은 LMS(2,000바이트)를 발송 할 수 있으며 발송된 문자는 기본모듈에 의해 전송상태, 결과, 전송일시 보기, 예약취소 등이 종합적으로 관리됩니다.
예제파일: example.0.1.zip
<?php
if (!defined('__ZBXE__')) exit();
/**
* @file example.addon.php
* @author diver (diver@coolsms.co.kr)
* @brief 게시판 새글, 댓글 알림 SMS 발송
*
* MessageXE 기본모듈 API를 이용한 문자전송 예제입니다.
* 게시판의 글쓰기, 댓글달기 action에서 간단하게 문자를 발송합니다.
**/
// 애드온 작동 시점: after_module_proc
if ($called_position != 'after_module_proc')
return;
// 애드온 작동 액션 : procBoardInsertDocument(글쓰기), procBoardInsertComment(댓글달기)
if (Context::get('act') != 'procBoardInsertDocument' && Context::get('act') != 'procBoardInsertComment')
return;
if ($oMobilemessageController = &getController('mobilemessage'))
{
$args->type = 'SMS'; // 'LMS'로 변경하면 장문 2,000 바이트까지 전송됩니다. (기본 SMS)
$args->subject = 'LMS제목'; // 'LMS'으로 발송할 경우 20바이트 아내로 LMS제목을 입력합니다.(생략가능) 'SMS'로 발송할 경우 무시됩니다.
$args->recipient = '01612341234'; // 받는사람 폰번호 (필수)
$args->callback = '15881234'; // 보내는사람 전화번호 (필수)
$args->message = '새글 혹은 댓글이 올라왔습니다.'; // 문자내용 (필수)
$args->reservdate = '20091229180000'; // 2009년 12월 29일 저녁 6시 0분 0초에 발송예약, 현재시각보다 작으면 바로 발송(생략가능)
$oMobilemessageController->sendMessage($args);
}
?>
if (!defined('__ZBXE__')) exit();
/**
* @file example.addon.php
* @author diver (diver@coolsms.co.kr)
* @brief 게시판 새글, 댓글 알림 SMS 발송
*
* MessageXE 기본모듈 API를 이용한 문자전송 예제입니다.
* 게시판의 글쓰기, 댓글달기 action에서 간단하게 문자를 발송합니다.
**/
// 애드온 작동 시점: after_module_proc
if ($called_position != 'after_module_proc')
return;
// 애드온 작동 액션 : procBoardInsertDocument(글쓰기), procBoardInsertComment(댓글달기)
if (Context::get('act') != 'procBoardInsertDocument' && Context::get('act') != 'procBoardInsertComment')
return;
if ($oMobilemessageController = &getController('mobilemessage'))
{
$args->type = 'SMS'; // 'LMS'로 변경하면 장문 2,000 바이트까지 전송됩니다. (기본 SMS)
$args->subject = 'LMS제목'; // 'LMS'으로 발송할 경우 20바이트 아내로 LMS제목을 입력합니다.(생략가능) 'SMS'로 발송할 경우 무시됩니다.
$args->recipient = '01612341234'; // 받는사람 폰번호 (필수)
$args->callback = '15881234'; // 보내는사람 전화번호 (필수)
$args->message = '새글 혹은 댓글이 올라왔습니다.'; // 문자내용 (필수)
$args->reservdate = '20091229180000'; // 2009년 12월 29일 저녁 6시 0분 0초에 발송예약, 현재시각보다 작으면 바로 발송(생략가능)
$oMobilemessageController->sendMessage($args);
}
?>