Exemple #1
0
<?php

/**
 * #example_verify
 *
 * This sample code demonstrate how to verify sender number through CoolSMS Rest API PHP
 * for more info, visit
 * www.coolsms.co.kr
 */
use Nurigo\Api\SenderID;
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 SenderID($api_key, $api_secret);
    // handle_key are mandatory. must be filled
    $handle_key = 'C29CE02IOE9';
    // after register call. return value
    $result = $rest->verify($handle_key);
    print_r($result);
} catch (CoolsmsException $e) {
    echo $e->getMessage();
    // get error message
    echo $e->getCode();
    // get error code
}
Exemple #2
0
<?php

/**
 * #example_delete
 *
 * This sample code demonstrate how to delete sender number through CoolSMS Rest API PHP
 * for more info, visit
 * www.coolsms.co.kr
 */
use Nurigo\Api\SenderID;
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 SenderID($api_key, $api_secret);
    // handle_key are mandatory. must be filled
    $handle_key = 'C29CE02IOE9';
    // sender number handle key. check for 'example_list'
    $result = $rest->delete($handle_key);
    print_r($result);
} catch (CoolsmsException $e) {
    echo $e->getMessage();
    // get error message
    echo $e->getCode();
    // get error code
}
Exemple #3
0
/**
 * #example_register
 *
 * This sample code demonstrate how to request sender number register through CoolSMS Rest API PHP
 * for more info, visit
 * www.coolsms.co.kr
 */
use Nurigo\Api\SenderID;
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 SenderID($api_key, $api_secret);
    // phone are mandatory. must be filled
    $phone = '01000000000';
    // sender number to register
    // Optional parameters for your own needs
    // $site_user = '******'; // site user_id. '__private__' is default value
    $result = $rest->register($phone);
    // or $rest->register($phone, $site_user);
    print_r($result);
} catch (CoolsmsException $e) {
    echo $e->getMessage();
    // get error message
    echo $e->getCode();
    // get error code
}
/**
 * #example_set_default
 *
 * This sample code demonstrate how to set default sender number through CoolSMS Rest API PHP
 * for more info, visit
 * www.coolsms.co.kr
 */
use Nurigo\Api\SenderID;
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 SenderID($api_key, $api_secret);
    // handle_key are mandatory. must be filled
    $handle_key = 'C29CE02IOE9';
    // sender number handle key. check for 'example_list'
    // Optional parameters for your own needs
    // $site_user = '******'; // site user_id. '__private__' is default value
    $result = $rest->setDefault($handle_key);
    // or $rest->setDefault($handle_key, $site_user);
    print_r($result);
} catch (CoolsmsException $e) {
    echo $e->getMessage();
    // get error message
    echo $e->getCode();
    // get error code
}
<?php

/**
 * #example_list
 *
 * This sample code demonstrate how to check sender number list through CoolSMS Rest API PHP
 * for more info, visit
 * www.coolsms.co.kr
 */
use Nurigo\Api\SenderID;
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 SenderID($api_key, $api_secret);
    // Optional parameters for your own needs
    // $site_user = '******'; // site user_id. '__private__' is default value
    $result = $rest->getSenderidList();
    // or $rest->senderidList($site_user);
    print_r($result);
} catch (CoolsmsException $e) {
    echo $e->getMessage();
    // get error message
    echo $e->getCode();
    // get error code
}
<?php

/**
 * #example_get_default
 *
 * This sample code demonstrate how to get default sender number through CoolSMS Rest API PHP
 * for more info, visit
 * www.coolsms.co.kr
 */
use Nurigo\Api\SenderID;
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 SenderID($api_key, $api_secret);
    // Optional parameters for your own needs
    // $site_user = '******'; // site user_id. '__private__' is default value
    $result = $rest->getDefault();
    // or $rest->getDefault($site_user);
    print_r($result);
} catch (CoolsmsException $e) {
    echo $e->getMessage();
    // get error message
    echo $e->getCode();
    // get error code
}