define('LINE_API',"https://notify-api.line.me/api/notify");
$token = "l7Wazf4Fu7V5cbkFR7FNBZd1zjrfroAgZzqZPx8mEXR"; // Token ที่ได้จากเว็บ LINE Notify
// ======== ฟังก์ชันเตรียมส่งข้อความ =============
function send_msg($message,$token){
$queryData = array('message' => $message);
$queryData = http_build_query($queryData,'','&');
$headerOptions = array(
'http'=>array(
'method'=>'POST',
'header'=> "Content-Type: application/x-www-form-urlencoded\r\n"
."Authorization: Bearer ".$token."\r\n"
."Content-Length: ".strlen($queryData)."\r\n",
'content' => $queryData
),
);
$context = stream_context_create($headerOptions);
$result = file_get_contents(LINE_API,FALSE,$context);
$res = json_decode($result);
return $res;
}
// ======== จบ : ฟังก์ชันเตรียมส่งข้อความ =============
// ========= ส่งข้อความ =============
$msg= "เย็นนี้ 17:00 น. ขอให้ทุกท่านเข้าประชุมออนไลน์โดยพร้อมเพรียงกัน"; //ข้อความที่ต้องการส่ง สูงสุด 1000 ตัวอักษร
send_msg($msg,$token);