%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
| Server IP : 14.207.165.8 / Your IP : 216.73.216.26 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/thread-self/root/var/www/html/ppaobm/backend/controllers/ |
Upload File : |
<?php
namespace backend\controllers;
use backend\models\LineBot;
use yii\helpers\Url;
use backend\modules\chanpalace\models\Chanpalace;
class LineBotController extends \yii\web\Controller {
public function beforeAction($action) {
return parent::beforeAction($action);
}
public function actionChanpalacebot($id) {
$data = Chanpalace::find()->where(['id' => $id])->one();
$message = 'ขณะมีผู้แจ้งขอเข้าชมใหม่จากคุณ : '.$data->name . '('.$data->tel.')' .' ขอเข้าเยี่ยมชมวันที่ : '.$data->datein;
$model = new LineBot();
$model->message = $message;
$model->save(false);
$res = $this->notify_message($message);
}
public function notify_message($message) {
$line_api = 'https://notify-api.line.me/api/notify';
$line_token = 'Hm5hSSBt0HCty5YRL0ux1GkOjpDPds7DkaSBBNdOrjN';
$queryData = array(
'message' => $message,
// 'stickerPackageId' => 1,
// 'stickerId' => 16
);
$queryData = http_build_query($queryData, '', '&');
$headerOptions = array(
'http' => array(
'method' => 'POST',
'header' => "Content-Type: application/x-www-form-urlencoded\r\n"
. "Authorization: Bearer " . $line_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;
}
}