Simple PHP LINE BOT using cURL without line SDK
by Nontachai Korninai
public function getChannelAccessToken(){
$channelAccessToken = "<YOUR CHANNEL ACCESS TOKEN>";
return $channelAccessToken;
}
public function getChannelSecret(){
$channelSecret = "<YOUR CHANNEL SECRET>";
return $channelSecret;
}
require_once __DIR__ . '/lineBot.php';
$bot = new Linebot();
$text = $bot->getMessageText(); //when user send text to bot
$bot->reply($text); // bot reply to user
$userId = $bot->getUserId();
$bot->pushText($userId, 'Hello Simple Text!');
$imageUrl = "https://example.com/panda.jpg";
$bot->pushImage($userId, $imageUrl);
$videoUrl = "https://example.com/avengers.mp4";
$coverImage = "https://example.com/cover.jpg";
$bot->pushVideo($userId, $videoUrl, $coverImage);
Please refer to the official API documents for details.