/**
 * #example_new_group
 *
 * This sample code demonstrate how to create sms group through CoolSMS Rest API PHP
 * for more info, visit
 * www.coolsms.co.kr
 */
use Nurigo\Api\GroupMessage;
use Nurigo\Exceptions\CoolsmsException;
require_once __DIR__ . "/../../bootstrap.php";
// api_key and api_secret can be obtained from www.coolsms.co.kr/credentials
$api_key = '#ENTER_YOUR_OWN#';
$api_secret = '#ENTER_YOUR_OWN#';
try {
    // initiate rest api sdk object
    $rest = new GroupMessage($api_key, $api_secret);
    // Optional parameters for your own needs
    $options = new stdClass();
    // $options->charset = 'utf8'; 				// utf8, euckr default value is utf8
    // $options->srk = '';						// Solution key
    // $options->mode = 'test';					// If 'test' value. refund cash to point
    // $options->delay = 10;					// '0~20' delay messages
    // $options->force_sms = true;				// 'true or false' always send sms
    // $options->app_version = '';				// App version
    $result = $rest->createGroup($options);
    print_r($result);
} catch (CoolsmsException $e) {
    echo $e->getMessage();
    // get error message
    echo $e->getCode();
    // get error code
<?php

/**
 * #example_group_info
 *
 * This sample code demonstrate how to check group info through CoolSMS Rest API PHP
 * for more info, visit
 * www.coolsms.co.kr
 */
use Nurigo\Api\GroupMessage;
use Nurigo\Exceptions\CoolsmsException;
require_once __DIR__ . "/../../bootstrap.php";
// api_key and api_secret can be obtained from www.coolsms.co.kr/credentials
$api_key = '#ENTER_YOUR_OWN#';
$api_secret = '#ENTER_YOUR_OWN#';
try {
    // initiate rest api sdk object
    $rest = new GroupMessage($api_key, $api_secret);
    // group_id are mandatory. must be filled
    $group_id = 'GIDFIWKEO19DIW29';
    // group id
    $result = $rest->getGroupInfo($group_id);
    print_r($result);
} catch (CoolsmsException $e) {
    echo $e->getMessage();
    // get error message
    echo $e->getCode();
    // get error code
}
/**
 * #example_add_messages
 *
 * This sample code demonstrate how to add json type messages into group through CoolSMS Rest API PHP
 * for more info, visit
 * www.coolsms.co.kr
 */
use Nurigo\Api\GroupMessage;
use Nurigo\Exceptions\CoolsmsException;
require_once __DIR__ . "/../../bootstrap.php";
// api_key and api_secret can be obtained from www.coolsms.co.kr/credentials
$api_key = '#ENTER_YOUR_OWN#';
$api_secret = '#ENTER_YOUR_OWN#';
try {
    // initiate rest api sdk object
    $rest = new GroupMessage($api_key, $api_secret);
    // options(message, group_id) are mandatory. must be filled
    $options = new stdClass();
    $text = array(0 => "안녕하세요.", 1 => "10000건을 20초안에 발송하는 빠르고 저렴한", 2 => "CoolSMS의 테스팅 문자입니다.");
    $messages = array();
    foreach ($text as $val) {
        $message = new stdClass();
        $message->type = "SMS";
        $message->to = "01000000000";
        $message->from = "01000000000";
        $message->text = $val;
        $messages[] = $message;
        // Optional parameters for your own needs
        // $message->type = 'SMS';                       // Message type ( SMS, LMS, MMS, ATA )
        // $message->image_id = 'IM289E9CISNWIC'         // image_id. type must be set as 'MMS'
        // $message->refname = '';                       // Reference name
Exemple #4
0
<?php

/**
 * #example_send
 *
 * This sample code demonstrate how to send group sms through CoolSMS Rest API PHP
 * for more info, visit
 * www.coolsms.co.kr
 */
use Nurigo\Api\GroupMessage;
use Nurigo\Exceptions\CoolsmsException;
require_once __DIR__ . "/../../bootstrap.php";
// api_key and api_secret can be obtained from www.coolsms.co.kr/credentials
$api_key = '#ENTER_YOUR_OWN#';
$api_secret = '#ENTER_YOUR_OWN#';
try {
    // initiate rest api sdk object
    $rest = new GroupMessage($api_key, $api_secret);
    // group_id are mandatory. must be filled
    $group_id = 'GID56CC00E21C4DC';
    // group id. ex) '1GCOLS23BDG'
    $result = $rest->sendGroupMessage($group_id);
    print_r($result);
} catch (CoolsmsException $e) {
    echo $e->getMessage();
    // get error message
    echo $e->getCode();
    // get error code
}
/**
 * #example_add_messages
 *
 * This sample code demonstrate how to add messages into group through CoolSMS Rest API PHP
 * for more info, visit
 * www.coolsms.co.kr
 */
use Nurigo\Api\GroupMessage;
use Nurigo\Exceptions\CoolsmsException;
require_once __DIR__ . "/../../bootstrap.php";
// api_key and api_secret can be obtained from www.coolsms.co.kr/credentials
$api_key = '#ENTER_YOUR_OWN#';
$api_secret = '#ENTER_YOUR_OWN#';
try {
    // initiate rest api sdk object
    $rest = new GroupMessage($api_key, $api_secret);
    // options(to, from, text) are mandatory. must be filled
    $options = new stdClass();
    $options->to = '01000000000';
    // 수신번호
    $options->from = '01000000000';
    // 발신번호
    $options->text = '안녕하세요. 10000건을 20초안에 발송하는 빠르고 저렴한 CoolSMS의 테스팅 문자입니다. ';
    // 문자내용
    $options->group_id = 'GID56CC00E21C4DC';
    // group id
    // Optional parameters for your own needs
    // $options->type = 'SMS';                       // Message type ( SMS, LMS, MMS, ATA )
    // $options->image_id = 'IM289E9CISNWIC'	       // image_id. type must be set as 'MMS'
    // $options->refname = '';					             // Reference name
    // $options->country = 82;		                   // Korea(82) Japan(81) America(1) China(86) Default is Korea
<?php

/**
 * #example_delete_messages
 *
 * This sample code demonstrate how to delete messages through CoolSMS Rest API PHP
 * for more info, visit
 * www.coolsms.co.kr
 */
use Nurigo\Api\GroupMessage;
use Nurigo\Exceptions\CoolsmsException;
require_once __DIR__ . "/../../bootstrap.php";
// api_key and api_secret can be obtained from www.coolsms.co.kr/credentials
$api_key = '#ENTER_YOUR_OWN#';
$api_secret = '#ENTER_YOUR_OWN#';
try {
    // initiate rest api sdk object
    $rest = new GroupMessage($api_key, $api_secret);
    // group_id, message_ids are mandatory. must be filled
    $group_id = 'GID56CC00E21C4DC';
    // group id
    $message_ids = '2838DFJFE02EI10TM';
    // message ids. ex) '2838DFJFE02EI10TM','RGGBB11545'
    $result = $rest->deleteMessages($group_id, $message_ids);
    print_r($result);
} catch (CoolsmsException $e) {
    echo $e->getMessage();
    // get error message
    echo $e->getCode();
    // get error code
}
<?php

/**
 * #example_delete_group
 *
 * This sample code demonstrate how to delete sms group through CoolSMS Rest API PHP
 * for more info, visit
 * www.coolsms.co.kr
 */
use Nurigo\Api\GroupMessage;
use Nurigo\Exceptions\CoolsmsException;
require_once __DIR__ . "/../../bootstrap.php";
// api_key and api_secret can be obtained from www.coolsms.co.kr/credentials
$api_key = '#ENTER_YOUR_OWN#';
$api_secret = '#ENTER_YOUR_OWN#';
try {
    // initiate rest api sdk object
    $rest = new GroupMessage($api_key, $api_secret);
    // group_ids are mandatory. must be filled
    $group_ids = 'GID56CC00E21C4DC';
    // ex) '1GCOLS23BDG','RGGBB11545'
    $result = $rest->deleteGroups($group_ids);
    print_r($result);
} catch (CoolsmsException $e) {
    echo $e->getMessage();
    // get error message
    echo $e->getCode();
    // get error code
}
/**
 * #example_message_list
 *
 * This sample code demonstrate check message list through CoolSMS Rest API PHP
 * for more info, visit
 * www.coolsms.co.kr
 */
use Nurigo\Api\GroupMessage;
use Nurigo\Exceptions\CoolsmsException;
require_once __DIR__ . "/../../bootstrap.php";
// api_key and api_secret can be obtained from www.coolsms.co.kr/credentials
$api_key = '#ENTER_YOUR_OWN#';
$api_secret = '#ENTER_YOUR_OWN#';
try {
    // initiate rest api sdk object
    $rest = new GroupMessage($api_key, $api_secret);
    // Optional parameters for your own needs
    $group_id = 'GID57317013931B0';
    // group id
    $offset = 0;
    // default 0
    $limit = 20;
    // default 20
    $result = $rest->getMessageList($group_id, $offset, $limit);
    print_r($result);
} catch (CoolsmsException $e) {
    echo $e->getMessage();
    // get error message
    echo $e->getCode();
    // get error code
}
 * #example_send_process
 *
 * This sample code demonstrate how to send group message through CoolSMS Rest API PHP
 * for more info, visit
 * www.coolsms.co.kr
 */
use Nurigo\Api\GroupMessage;
use Nurigo\Exceptions\CoolsmsException;
require_once __DIR__ . "/../../bootstrap.php";
// api_key and api_secret can be obtained from www.coolsms.co.kr/credentials
$api_key = '#ENTER_YOUR_OWN#';
$api_secret = '#ENTER_YOUR_OWN#';
try {
    $options = new stdClass();
    // initiate rest api sdk object
    $rest = new GroupMessage($api_key, $api_secret);
    // create group
    $result = $rest->createGroup($options);
    $group_id = $result->group_id;
    print_r($result);
    // add messages
    $options->to = '01000000000';
    $options->from = '01000000000';
    $options->text = '안녕하세요. 10000건을 20초안에 발송하는 빠르고 저렴한 CoolSMS의 테스팅 문자입니다. ';
    $options->group_id = $group_id;
    // group id
    $result = $rest->addMessages($options);
    print_r($result);
    // send messages
    $result = $rest->sendGroupMessage($group_id);
    print_r($result);
<?php

/**
 * #example_group_list
 *
 * This sample code demonstrate how to check group list through CoolSMS Rest API PHP
 * for more info, visit
 * www.coolsms.co.kr
 */
use Nurigo\Api\GroupMessage;
use Nurigo\Exceptions\CoolsmsException;
require_once __DIR__ . "/../../bootstrap.php";
// api_key and api_secret can be obtained from www.coolsms.co.kr/credentials
$api_key = '#ENTER_YOUR_OWN#';
$api_secret = '#ENTER_YOUR_OWN#';
try {
    // initiate rest api sdk object
    $rest = new GroupMessage($api_key, $api_secret);
    $result = $rest->getGroupList();
    print_r($result);
} catch (CoolsmsException $e) {
    echo $e->getMessage();
    // get error message
    echo $e->getCode();
    // get error code
}