|
1
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
2
|
|
|
3
|
<?php
|
|
4
|
define('LINE_API',"https://notify-api.line.me/api/notify");
|
|
5
|
|
|
6
|
$token = "tomMXIh9sQFDJH1iP0dwaZxc5pSuzg44AQpnUKjR0FH"; //Line Notify Kamol Group TOMAS
|
|
7
|
//$token = "SNeIOvkSmjyJOGu0sroZ84hSmGj5PPY7VLOPXlHASsH"; //Line Notify Kamol Group Technical regular
|
|
8
|
//$token = "IE8rhhE6SQeM9uuJ64uHbtVhL2DNDsmDefpy5wzBxEV"; //Line Notify Kamol Test Token
|
|
9
|
//$token = "Mbl2MU5SZAOfHGhwFpYJUEUOHuakN0vPftmR2PMI0dd"; //Line Notify Kamol_II
|
|
10
|
//$token = "SLmHI7vUiEdh3W9szgSrHCfukMGlBnU6iTzVxJom4zj"; ////Line Notify Group Kamol_II
|
|
11
|
|
|
12
|
$str = "Test Line Notify API "; //ข้อความที่ต้องการส่ง สูงสุด 1000 ตัวอักษร
|
|
13
|
|
|
14
|
$name=$_POST["name"];
|
|
15
|
$phpColdWater=$_POST["phpColdWater"];
|
|
16
|
$strColdWater="Cold Water +" . "$phpColdWater<br />";
|
|
17
|
$lineColdWater="Cold Water +" . "$phpColdWater\r\n";
|
|
18
|
$phpHotWater=$_POST["phpHotWater"];
|
|
19
|
$strHotWater="Hot Water +" . "$phpHotWater<br />";
|
|
20
|
$lineHotWater="Hot Water +" . "$phpHotWater\r\n";
|
|
21
|
$phpHotTea=$_POST["phpHotTea"];
|
|
22
|
$strHotTea="Hot Tea +" . "$phpHotTea<br />";
|
|
23
|
$lineHotTea="Hot Tea +" . "$phpHotTea\r\n";
|
|
24
|
$phpHotCoffee=$_POST["phpHotCoffee"];
|
|
25
|
$strHotCoffee="Hot Coffee +" . "$phpHotCoffee<br />";
|
|
26
|
$lineHotCoffee="Hot Coffee +" . "$phpHotCoffee\r\n";
|
|
27
|
$strMessage="<br />$name<br />";
|
|
28
|
$str="\r\n$name\r\n";
|
|
29
|
if ($phpColdWater > "0") {
|
|
30
|
$strMessage = $strMessage . $strColdWater;
|
|
31
|
$str = $str . $lineColdWater;
|
|
32
|
}
|
|
33
|
if ($phpHotWater > "0") {
|
|
34
|
$strMessage = $strMessage . $strHotWater;
|
|
35
|
$str = $str . $lineHotWater;
|
|
36
|
}
|
|
37
|
if ($phpHotTea > "0") {
|
|
38
|
$strMessage = $strMessage . $strHotTea;
|
|
39
|
$str = $str . $lineHotTea;
|
|
40
|
}
|
|
41
|
if ($phpHotCoffee > "0") {
|
|
42
|
$strMessage = $strMessage . $strHotCoffee;
|
|
43
|
$str = $str . $lineHotCoffee;
|
|
44
|
}
|
|
45
|
//echo "$strMessage";
|
|
46
|
if ($phpColdWater > "0" || $phpHotWater > "0" || $phpHotTea > "0" || $phpHotCoffee > "0") {
|
|
47
|
$res = notify_message($str,$token);
|
|
48
|
print_r($res);
|
|
49
|
print_r($strMessage);
|
|
50
|
}
|
|
51
|
else{
|
|
52
|
print_r("Please press the plus drink button before ordering a drink.");
|
|
53
|
}
|
|
54
|
|
|
55
|
function notify_message($message,$token){
|
|
56
|
$queryData = array('message' => $message);
|
|
57
|
$queryData = http_build_query($queryData,'','&');
|
|
58
|
$headerOptions = array(
|
|
59
|
'http'=>array(
|
|
60
|
'method'=>'POST',
|
|
61
|
'header'=> "Content-Type: application/x-www-form-urlencoded\r\n"
|
|
62
|
."Authorization: Bearer ".$token."\r\n"
|
|
63
|
."Content-Length: ".strlen($queryData)."\r\n",
|
|
64
|
'content' => $queryData
|
|
65
|
),
|
|
66
|
);
|
|
67
|
$context = stream_context_create($headerOptions);
|
|
68
|
$result = file_get_contents(LINE_API,FALSE,$context);
|
|
69
|
$res = json_decode($result);
|
|
70
|
return $res;
|
|
71
|
}
|
|
72
|
?>
|