Skip to content

7elven/Simple-PHP-LINE-BOT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple-PHP-LINE-BOT

Simple PHP LINE BOT using cURL without line SDK
by Nontachai Korninai

Setting

go to file setting.php
public function getChannelAccessToken(){
	$channelAccessToken = "<YOUR CHANNEL ACCESS TOKEN>";
	return $channelAccessToken;
}
        
public function getChannelSecret(){
	$channelSecret = "<YOUR CHANNEL SECRET>";
	return $channelSecret;
}

Example : Simple BOT

When you finished setting, Create new index.php

reply

require_once __DIR__ . '/lineBot.php';
$bot = new Linebot();

$text = $bot->getMessageText(); //when user send text to bot	
$bot->reply($text); // bot reply to user

get User Id

$userId = $bot->getUserId();

Push Text

$bot->pushText($userId, 'Hello Simple Text!');

Push Image

$imageUrl = "https://example.com/panda.jpg";
$bot->pushImage($userId, $imageUrl);

Push Video

$videoUrl = "https://example.com/avengers.mp4";
$coverImage = "https://example.com/cover.jpg";
$bot->pushVideo($userId, $videoUrl, $coverImage);

About LINE Messaging API

Please refer to the official API documents for details.

en: https://devdocs.line.me/en/

ja: https://devdocs.line.me/ja/

Releases

No releases published

Packages

No packages published

Languages