/** * 알림톡 발송 */ public static function sendATA($options) { // 인증정보만 가진 Object를 따로 생성 $authentication_obj = new stdClass(); $authentication_obj->api_key = $options->api_key; $authentication_obj->coolsms_user = $options->coolsms_user; $authentication_obj->timestamp = $options->timestamp; $authentication_obj->salt = $options->salt; $authentication_obj->signature = $options->signature; // create group self::$method = 0; self::setContent($authentication_obj); $host = sprintf("%s%s/%s/%s?%s", self::$host, self::$resource, self::$version, "new_group", self::$content); $result = self::requestGet($host); if (self::$error_flag == true) { self::$result->code = $result; return; } $group_id = $result->group_id; // add messages self::$method = 1; self::setContent($options); $host = sprintf("%s%s/%s/groups/%s/%s", self::$host, self::$resource, self::$version, $group_id, "add_messages.json"); $result = self::requestPOST($host); if (self::$error_flag == true) { self::$result->code = $result; return; } // success, error count 구하기 $success_count = 0; $error_count = 0; foreach ($result as $k => $v) { $success_count = $success_count + $v->success_count; $error_count = $error_count + $v->error_count; } self::$result->success_count = $success_count; self::$result->error_count = $error_count; // send messages self::$method = 1; self::setContent($authentication_obj); $host = sprintf("%s%s/%s/groups/%s/%s", self::$host, self::$resource, self::$version, $group_id, "send"); $result = self::requestPOST($host); if (self::$error_flag == true) { self::$result->code = $result; return; } }