HEX
Server: Apache/2
System: Linux mail.lnwhostname.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: suanchonac (1128)
PHP: 7.4.25
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/suanchonac/public_html/skcroom2567/_test/n3JaKCgNQu2xUIGN.php
<?php
// ข้อความที่ต้องการส่ง
$message = "ทดสอบการส่งข้อความผ่าน LINE Notify";

// หากต้องการใช้ Token อื่น ๆ ให้แทนที่ค่านี้ด้วย Token ที่ได้จากการสร้างของ LINE Notify
$token = "JEg5AJoUV2r9gZ0UWCE3cP9ux66blZOuBLCWAOoxBJr";

// URL สำหรับส่งข้อความผ่าน LINE Notify
$url = "http://notify-api.line.me/api/notify";

// ข้อมูลที่จะส่งไปยัง LINE Notify
$data = http_build_query([
    "message" => $message
]);

// ตัวเลือกสำหรับการส่งข้อมูลด้วย cURL
$options = [
    CURLOPT_URL => $url,
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POSTFIELDS => $data,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $token",
        "Content-Type: application/x-www-form-urlencoded"
    ]
];

// สร้าง cURL handle
$ch = curl_init();
curl_setopt_array($ch, $options);

// ดำเนินการเรียก API LINE Notify
$response = curl_exec($ch);

// ตรวจสอบสถานะการเรียก API
if ($response === false) {
    echo "เกิดข้อผิดพลาดในการเรียก API LINE Notify: " . curl_error($ch);
} else {
    echo "ส่งข้อความผ่าน LINE Notify สำเร็จ";
}

// ปิด cURL handle
curl_close($ch);

/*
// ข้อความที่ต้องการส่ง
$message = "ทดสอบการส่งข้อความผ่าน LINE Notify";

// หากต้องการใช้ Token อื่น ๆ ให้แทนที่ค่านี้ด้วย Token ที่ได้จากการสร้างของ LINE Notify
$token = "JEg5AJoUV2r9gZ0UWCE3cP9ux66blZOuBLCWAOoxBJr";

// URL สำหรับส่งข้อความผ่าน LINE Notify
$url = "https://notify-api.line.me/api/notify";

// ข้อมูลที่จะส่งไปยัง LINE Notify
$data = http_build_query([
    "message" => $message
]);

// ตัวเลือกสำหรับการส่งข้อมูล
$options = [
    "http" => [
        "header" => "Authorization: Bearer " . $token . "\r\n" . "Content-Type: application/x-www-form-urlencoded\r\n",
        "method" => "POST",
        "content" => $data
    ]
];

// สร้าง context สำหรับการส่งข้อมูล
$context = stream_context_create($options);

// ส่งข้อมูลไปยัง LINE Notify
$result = file_get_contents($url, false, $context);

// ตรวจสอบผลลัพธ์
if ($result === FALSE) {
    echo "เกิดข้อผิดพลาดในการส่งข้อมูล";
} else {
    echo "ส่งข้อความผ่าน LINE Notify สำเร็จ";
}
*/




/*
$line_api = 'https://notify-api.line.me/api/notify';
$access_token = 'Of7UfC2fewj30WIqI2afJbaFnopwudDSpIO2GlzEVNz'; // access token ที่เราสร้างขึ้น
$str = 'มีการเข้าใช้งานระบบเช็คเกรดออนไลน์
- ชื่อ: นางสาวศิรินภา  ทรัพย์ศิริ
- รหัสนักศึกษา: 5622222
- เลขบัตรประชาชน: 13134131252
- สาขาวิชา: การบัญชี 
- เมื่อ:  18/12/2017 เวลา 12.00 น.
'; //ข้อความที่ต้องการส่ง สูงสุด 1000 ตัวอักษร

$image_thumbnail_url = ''; // ขนาดสูงสุด 240×240px JPEG
$image_fullsize_url = ''; // ขนาดสูงสุด 1024×1024px JPEG
$sticker_package_id = ''; // ค่าเดิมคือ 1, Package ID ของสติกเกอร์ ดูได้จากนี่ https://devdocs.line.me/files/sticker_list.pdf
$sticker_id = ''; // ค่าเดิมคือ 410, ID ของสติกเกอร์
$message_data = array(
	'message' => $str,
	'imageThumbnail' => $image_thumbnail_url,
	'imageFullsize' => $image_fullsize_url,
	'stickerPackageId' => $sticker_package_id,
	'stickerId' => $sticker_id
);
$result = send_notify_message($line_api, $access_token, $message_data);
//print_r($result);

function send_notify_message($line_api, $access_token, $message_data)
{
	$headers = array(
		'Method: POST',
		'Content-type: multipart/form-data',
		'Authorization: Bearer ' . $access_token
	);
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $line_api);
	curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $message_data);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	$result = curl_exec($ch);

	// Check Error
	if (curl_error($ch)) {
		$return_array = array(
			'status' => '000: send fail',
			'message' => curl_error($ch)
		);
	}
	else {
		$return_array = json_decode($result, true);
	}

	curl_close($ch);
	return $return_array;
}
*/
?>