객실예약스킨 sms 문자 깨짐 질문 > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

객실예약스킨 sms 문자 깨짐 질문 정보

객실예약스킨 sms 문자 깨짐 질문

본문

function SMS($message, $receive = null)
{
global $board;
list($id, $password) = explode('|', $board['bo_8']);
list($phone, $mobile) = explode('|', $board['bo_9']);
if(isset($receive) == false)
{
$receive = $mobile;
}
$SMS = new ICODE;
$SMS -> Connect($id, $password);
$SMS -> Add($phone, $receive, $message);
$SMS -> Send();
return;
}

function BLANK($string, $size)
{
for($i = 0; $i < $size; $i++)
{
$string .= ' ';
}
$result = substr($string, 0, $size);
return $result;
}

class ICODE
{
var $ID;
var $PASSWORD;
var $SERVER;
var $PORT;
var $DATA;

function Connect($id, $password)
{
$this -> ID = BLANK($id, 10);
$this -> PASSWORD = BLANK($password, 10);
$this -> SERVER = '211.172.232.124';
$this -> PORT = rand(7192, 7195);
return;
}

function Add($send, $mobile, $message)
{
$send = str_replace('-', null, $send);
$send = BLANK($send, 33);
$mobile = str_replace('-', null, $mobile);
$mobile = BLANK($mobile, 11);
$message = stripslashes($message);
$message = BLANK($message, 80);
$this -> DATA = '01144 ' . $this -> ID . $this -> PASSWORD . $mobile . $send . $message;
return;
}

function Send()
{
$fgets = null;
$fsockopen = fsockopen($this -> SERVER, $this -> PORT);
fputs($fsockopen, $this -> DATA);
while(isset($fgets) == false)
{
$fgets = fgets($fsockopen, 30);
}
fclose($fsockopen);
$result = substr($fgets, 0, 19);
$key = '0223  00' . substr($this -> DATA, 26, 11);
$this -> DATA = null;
if($result != $key)
{
return false;
}
return true;
}
}

일단 sms를 아이코드에 보내는 함수들입니다.

현재 UTF-8로 설정되어 있어 보내면 문자가 깨져 나오네요

iconv함수로 문자내용을 EUC-KR로 변환뒤 전송해야하는데 어디에 iconv함수를 넣어야 할지 모르겠네요. 여러번 테스트 해봤는데 다운되더군요 ㅠㅠ

$message = conv("UTF-8", "EUC-KR", $message); 도 해보고 했는데 다 다운이되요...

고수님들 꼭 좀 도와주세요 ㅠ
  • 복사

댓글 전체

해피정님께서 답을 주셨네요! 저도 이것때문에 고민 많이 했는데...

function Add($send, $mobile, $message)
{
$send = str_replace('-', null, $send);
$send = BLANK($send, 33);
$mobile = str_replace('-', null, $mobile);
$mobile = BLANK($mobile, 11);
// 이곳에 넣으니까 되네요!!! ^^
$message = iconv('UTF-8', 'EUC-KR', $message);
$message = stripslashes($message);
$message = BLANK($message, 80);
$this -> DATA = '01144 ' . $this -> ID . $this -> PASSWORD . $mobile . $send . $message;
return;
}

해피정님 감사해요!!!
© SIRSOFT
현재 페이지 제일 처음으로