<?php
require_once __DIR__ . '/../config.php';

/* ===============================
   CONFIG LINE
================================ */
//define("LINE_CHANNEL_ACCESS_TOKEN", "PUT_YOUR_CHANNEL_ACCESS_TOKEN");
define("2008722542", "43ffa0094586d20fd5d89b3708e11986");

/* ===============================
   SEND LINE MESSAGE
================================ */
function line_push($userId, $text){
    $data = [
        "to" => $userId,
        "messages" => [[
            "type" => "text",
            "text" => $text
        ]]
    ];

    $ch = curl_init("https://api.line.me/v2/bot/message/push");
    curl_setopt_array($ch, [
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => json_encode($data),
        CURLOPT_HTTPHEADER => [
            "Content-Type: application/json",
            "Authorization: Bearer ".LINE_CHANNEL_ACCESS_TOKEN
        ],
        CURLOPT_RETURNTRANSFER => true
    ]);
    curl_exec($ch);
    curl_close($ch);
}
