Example #1
0
 public function phone_check()
 {
     require_once APPPATH . 'libraries/coolsms.php';
     $secret = mt_rand() % 9000 + 1000;
     $SESSION['phone_check'] = $secret;
     $phone = $this->input->get("phone");
     $api_key = 'NCS53C2A831865B7';
     $api_secret = 'BEF1FE1C24C72F28C488728F91A2C838';
     $rest = new coolsms($api_key, $api_secret);
     $options->type = "SMS";
     $options->to = $phone;
     $options->from = "01071097327";
     $options->text = "인증 번호는 " . $secret . " 입니다. 올바르게 입력해주세요.";
     $rest->send($options);
     echo "<div id='kkk' >" . $secret . "</div>";
 }
Example #2
0
<?php

/* #example_sent
 *
 **  This sample code demonstrate how to check sms result through CoolSMS Rest API PHP v1.0
 **  for more info, visit
 **  www.coolsms.co.kr
 *
 */
include_once "../coolsms.php";
/*
 ** api_key and api_secret can be obtained from www.coolsms.co.kr/credentials
 */
$apikey = '#ENTER_YOUR_OWN#';
$apisecret = '#ENTER_YOUR_OWN#';
//initiate rest api sdk object
$rest = new coolsms($apikey, $apisecret);
//set necessary options
$options->mid = 'M52CB443257C61';
//message id
//$options->gid = 'G52CB4432576C8';			//group id
//$options->count = '40';					//result return counts. default is 20
//$options->page = '1';						//page
//$options->s_crpt = '01012345678';			//search sent result by recipient number
//$options->s_start = '201401070915';		//set search start date  ex) 201401070915
//$options->s_end = '201401071230';			//set search end date	 ex) 201401071230
$result = $rest->sent($options)->getResult();
print_r($result);
Example #3
0
    $mail->addAddress($to_email, $to_name);
    // 받을 사람 email 주소와 표시될 이름 (표시될 이름은 생략가능)
    $mail->Subject = $title;
    // 메일 제목
    $mail->msgHTML($content);
    // 메일 내용 (HTML 형식도 되고 그냥 일반 텍스트도 사용 가능함)
    $mail->Send();
    // 실제로 메일을 보냄
    //echo "메일을 전송하였습니다.";
} catch (phpmailerException $e) {
    echo $e->errorMessage();
} catch (Exception $e) {
    echo $e->getMessage();
}
require_once "coolsms.php";
$sms = new coolsms();
$sms->appversion("TEST/1.0");
$sms->setRealMode();
$sms->charset("utf8");
$sms->setuser("knight2995", "valentine1594");
$msg = "http://112.165.19.156/xe/" . $document_seq . " \r\n" . $Tittle;
$sms->addsms("01071214721", "01071214721", $msg);
$sms->addsms("01098323206", "01071214721", $msg);
$sms->addsms("01025274533", "01071214721", $msg);
if (!$sms->connect()) {
    // 오류처리
    echo "서버에 접속할 수 없습니다.";
    exit(1);
}
/**
 * 추가된 문자를 모두 전송합니다.
Example #4
0
 /**
  * @brief set callback url
  **/
 function setcallbackurl($callback_url)
 {
     $tbsp = array();
     $tbsp["VERSION"] = $this->VERSION_STR;
     $tbsp["MODULE-VERSION"] = $this->module_version;
     if ($this->app_version) {
         $tbsp["APP-VERSION"] = $this->app_version;
     }
     $tbsp["COMMAND"] = "CALLBACK-URL";
     $tbsp["URL"] = $callback_url;
     if ($this->crypt == "MD5") {
         $tbsp["CRYPT-METHOD"] = "MD5";
     }
     $tbsp["AUTH-ID"] = $this->userid;
     $tbsp["AUTH-PASS"] = $this->passwd;
     $version = "Unknown";
     if (function_exists("phpversion")) {
         $version = phpversion();
     }
     $language = "PHP-" . $version;
     $tbsp["LANGUAGE"] = $language;
     if ($this->options) {
         $tbsp["OPTIONS"] = $this->options;
     }
     $cscp_str = coolsms::cscp_build(coolsms::tbsp_build($tbsp));
     fputs($this->sockfp, $cscp_str);
     $tbspstr = coolsms::cscp_read($this->sockfp);
     if (!$tbspstr) {
         $this->errmsg = "cscp_read error";
         $this->__write_log__("cscp_read error");
         return $tbsp;
     }
     $tbsp = coolsms::tbsp_parse($tbspstr);
     if (!$tbsp) {
         $this->errmsg = "tbsp_parse error";
         $this->__write_log__("tbsp_parse error");
         return $tbsp;
     }
     return $tbsp;
 }
Example #5
0
<?php

/* #example_sent
 *
 **  This sample code demonstrate how to check sms result through CoolSMS Rest API PHP v1.0
 **  for more info, visit
 **  www.coolsms.co.kr
 *
 */
include_once "coolsms.php";
/*
 ** api_key and api_secret can be obtained from www.coolsms.co.kr/credentials
 */
$apikey = '#ENTER_YOUR_OWN#';
$apisecret = '#ENTER_YOUR_OWN#';
//initiate rest api sdk object
$rest = new coolsms($apikey, $apisecret);
//set necessary options
$options->mid = 'M52CB443257C61';
//message id
//$options->gid = 'G52CB4432576C8';			//group id
//$options->count = '40';					//result return counts. default is 20
//$options->page = '1';						//page
//$options->s_crpt = '01012345678';			//search sent result by recipient number
//$options->s_start = '201401070915';		//set search start date  ex) 201401070915
//$options->s_end = '201401071230';			//set search end date	 ex) 201401071230
$result = $rest->sent($options);
print_r($result);
Example #6
0
/* #example_send
 *
 **  This sample code demonstrate how to send sms through CoolSMS Rest API PHP v1.0
 **  for more info, visit
 **  www.coolsms.co.kr
 *
 */
include_once "../coolsms.php";
/*
 **  api_key and api_secret can be obtained from www.coolsms.co.kr/credentials
 */
$apikey = '#ENTER_YOUR_OWN#';
$apisecret = '#ENTER_YOUR_OWN#';
//initiate rest api sdk object
$rest = new coolsms($apikey, $apisecret);
$options->timestamp = (string) time();
// 등록된 sender_ids 전체 불러온후 발신번호 설정
$senderid = $rest->get_senderid_list($options)->getResult();
print_r($senderid);
if (is_array($senderid) && count($senderid)) {
    $options->from = $senderid[0]->phone_number;
}
//기본설정된 전화번호만 불러온후 발송
/*
$default = $rest->get_default($options)->getResult();
$options->from = $default->phone_number;
*/
/*
 **  5 options(timestamp, to, from, type, text) are mandatory. must be filled
 */
Example #7
0
/* #example_send
 *
 **  This sample code demonstrate how to send sms through CoolSMS Rest API PHP v1.0
 **  for more info, visit
 **  www.coolsms.co.kr
 *
 */
include_once "coolsms.php";
/*
 **  api_key and api_secret can be obtained from www.coolsms.co.kr/credentials
 */
$apikey = '#ENTER_YOUR_OWN#';
$apisecret = '#ENTER_YOUR_OWN#';
//initiate rest api sdk object
$rest = new coolsms($apikey, $apisecret);
/*
 **  5 options(timestamp, to, from, type, text) are mandatory. must be filled
 */
$options->timestamp = (string) time();
$options->to = '01000000000';
$options->from = '01000000000';
$options->type = 'SMS';
$options->text = '안녕하세요. 10000건을 20초안에 발송하는 빠르고 저렴한 CoolSMS의 테스팅 문자입니다. ';
$options->app_version = 'test app 1.2';
//application name and version
// Optional parameters for your own needs
//$options->image = 'desert.jpg'; 			//image for MMS. type must be set as 'MMS'
//$options->refname = '';					//Reference name
//$options->country = 'KR';					//Korea(KR) Japan(JP) America(USA) China(CN) Default is Korea
//$options->datetime = '20140106153000';	//Format must be(YYYYMMDDHHMISS) 2014 01 06 15 30 00 (2014 Jan 06th 3pm 30 00)
Example #8
0
<?php

/* #example_cancel
 *
 **  This sample code demonstrate how to cancel reserved sms through CoolSMS Rest API PHP v1.0
 **  for more info, visit
 **  www.coolsms.co.kr
 *
 */
include_once "coolsms.php";
/*
 ** api_key and api_secret can be obtained from www.coolsms.co.kr/credentials
 */
$apikey = '#ENTER_YOUR_OWN#';
$apisecret = '#ENTER_YOUR_OWN#';
//initiate rest api sdk object
$rest = new coolsms($apikey, $apisecret);
// Either mid or gid must be entered.
$options->mid = 'M52CB443257C61';
//message id.
//$options->gid = 'G52CB4432576C8';			//group id.
$rest->cancel($options);
//cancel does not return any.
Example #9
0
<?php

/* #example_balance
 *
 **  This sample code demonstrate how to check cash & point balance through CoolSMS Rest API PHP v1.0
 **  for more info, visit
 **  www.coolsms.co.kr
 *
 */
include_once "../coolsms.php";
/*
 ** api_key and api_secret can be obtained from www.coolsms.co.kr/credentials
 */
$apikey = '#ENTER_YOUR_OWN#';
$apisecret = '#ENTER_YOUR_OWN#';
//initiate rest api sdk object
$rest = new coolsms($apikey, $apisecret);
$result = $rest->balance()->getResult();
print_r($result);
Example #10
0
<?php

/* #example_balance
 *
 **  This sample code demonstrate how to check cash & point balance through CoolSMS Rest API PHP v1.0
 **  for more info, visit
 **  www.coolsms.co.kr
 *
 */
include_once "coolsms.php";
/*
 ** api_key and api_secret can be obtained from www.coolsms.co.kr/credentials
 */
$apikey = '#ENTER_YOUR_OWN#';
$apisecret = '#ENTER_YOUR_OWN#';
//initiate rest api sdk object
$rest = new coolsms($apikey, $apisecret);
$result = $rest->balance();
print_r($result);
Example #11
0
 protected static function requestPOST($host)
 {
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $host);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
     curl_setopt($ch, CURLOPT_SSLVERSION, 3);
     // SSL 버젼 (https 접속시에 필요)
     curl_setopt($ch, CURLOPT_HEADER, 0);
     // 헤더 출력 여부
     curl_setopt($ch, CURLOPT_POST, self::$method);
     // Post Get 접속 여부
     curl_setopt($ch, CURLOPT_TIMEOUT, 10);
     // TimeOut 값
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     // 결과값을 받을것인지
     $header = array("Content-Type:multipart/form-data");
     // route가 있으면 header에 붙여준다.
     if (self::$content['route']) {
         $header[] = "User-Agent:" . self::$content['route'];
     }
     curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
     curl_setopt($ch, CURLOPT_POSTFIELDS, self::$content);
     $result = json_decode(curl_exec($ch));
     // Check connect errors
     if (curl_errno($ch)) {
         self::$error_flag = true;
         $result = curl_error($ch);
     }
     curl_close($ch);
     return $result;
 }