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>"; }
$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); } /** * 추가된 문자를 모두 전송합니다. **/ $nsent = $sms->send(); // 오류검사 if ($sms->errordetected()) { echo "오류가 발생했습니다 : " . $sms->lasterror(); } /** * 연결을 끊습니다. */ $sms->disconnect(); /** * 결과를 출력합니다. * $sms->getr(); 으로 발송결과 array를 가져와서 사용할 수 있음. ($sms->printr() 함수 참조) */ //echo "{$nsent} 건에 대한 전송내용을 출력합니다.<br />"; //$sms->printr(); /**
} //기본설정된 전화번호만 불러온후 발송 /* $default = $rest->get_default($options)->getResult(); $options->from = $default->phone_number; */ /* ** 5 options(timestamp, to, from, type, text) are mandatory. must be filled */ $options->to = '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) //$options->mid = 'mymsgid01'; //set message id. Server creates automatically if empty //$options->gid = 'mymsg_group_id01'; //set group id. Server creates automatically if empty //$options->subject = 'Hello World'; //set msg title for LMS and MMS //$options->charset = 'euckr'; //For Korean language, set euckr or utf-8 /** * added REST API v1.5 **/ //$options->os_platform = 'Windows 7'; //Operating System. SDK creates automatically if empty //$options->dev_lang = 'PHP 5.3.3'; //Application development language. SDK creates automatically if empty //$options->sdk_version = 'PHP SDK 1.1'; //SDK version being used. SDK creates automatically if empty $result = $rest->send($options); print_r($result->getResult());