예제 #1
0
<?php

/**
 * #example_image_list
 *
 * This sample code demonstrate how to check image list through CoolSMS Rest API PHP
 * for more info, visit
 * www.coolsms.co.kr
 */
use Nurigo\Api\Image;
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 Image($api_key, $api_secret);
    // Optional parameters for your own needs
    $offset = 0;
    // default 0
    $limit = 20;
    // default 20
    $result = $rest->getImageList($offset, $limit);
    print_r($result);
} catch (CoolsmsException $e) {
    echo $e->getMessage();
    // get error message
    echo $e->getCode();
    // get error code
}
예제 #2
0
/**
 * #example_upload_image
 *
 * This sample code demonstrate how to upload image through CoolSMS Rest API PHP
 * for more info, visit
 * www.coolsms.co.kr
 */
use Nurigo\Api\Image;
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 Image($api_key, $api_secret);
    // image are mandatory. must be filled
    $image = 'images/test.jpg';
    // image
    // Optional parameters for your own needs
    // $encoding = 'binary'; // image encoding type (base64, binary) default binary
    $result = $rest->uploadImage($image);
    // or $rest->uploadImage($image, $encoding)
    print_r($result);
} catch (CoolsmsException $e) {
    echo $e->getMessage();
    // get error message
    echo $e->getCode();
    // get error code
}
예제 #3
0
<?php

/**
 * #example_delete_images
 *
 * This sample code demonstrate how to delete images through CoolSMS Rest API PHP
 * for more info, visit
 * www.coolsms.co.kr
 */
use Nurigo\Api\Image;
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 Image($api_key, $api_secret);
    // image_ids are mandatory. must be filled
    $image_ids = '';
    // image ids. ex)'IM34BWIDJ12','IMG2559GBB'
    $result = $rest->deleteImages($image_ids);
    print_r($result);
} catch (CoolsmsException $e) {
    echo $e->getMessage();
    // get error message
    echo $e->getCode();
    // get error code
}
예제 #4
0
<?php

/**
 * #example_image_info
 *
 * This sample code demonstrate how to check image info through CoolSMS Rest API PHP
 * for more info, visit
 * www.coolsms.co.kr
 */
use Nurigo\Api\Image;
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 Image($api_key, $api_secret);
    // image_id are mandatory. must be filled
    $image_id = '';
    // image id
    $result = $rest->getImageInfo($image_id);
    print_r($result);
} catch (CoolsmsException $e) {
    echo $e->getMessage();
    // get error message
    echo $e->getCode();
    // get error code
}