Skip to content

Instantly share code, notes, and snippets.

@aeknarinamn
aeknarinamn / LINEBOT.PHP
Last active June 18, 2022 06:25
LINE BOT EXAMPLE PHP EP1
<?php
/*Get Data From POST Http Request*/
$datas = file_get_contents('php://input');
/*Decode Json From LINE Data Body*/
$deCode = json_decode($datas,true);
file_put_contents('log.txt', file_get_contents('php://input') . PHP_EOL, FILE_APPEND);
$replyToken = $deCode['events'][0]['replyToken'];
$userId = $deCode['events'][0]['source']['userId'];
@aeknarinamn
aeknarinamn / LINEGETPROFILE.PHP
Last active July 9, 2019 15:44
LINEBOT GET PROFILE
<?php
$userId = "U1a81dc36b7c95042c6ee4718cd5a7c18";
$LINEDatas['url'] = "https://api.line.me/v2/bot/profile/".$userId;
$LINEDatas['token'] = "<YOUR-CHANNEL-ACCESS-TOKEN>";
$results = getLINEProfile($LINEDatas);
file_put_contents('log-profile.txt', $results['message'] . PHP_EOL, FILE_APPEND);
@aeknarinamn
aeknarinamn / LINEGETCONTENT.PHP
Last active July 19, 2019 21:28
LINEBOT GET CONTENT
<?php
define('UPLOAD_DIR', 'tmp_image/');
/*Get Data From POST Http Request*/
$datas = file_get_contents('php://input');
/*Decode Json From LINE Data Body*/
$deCode = json_decode($datas,true);
file_put_contents('log.txt', file_get_contents('php://input') . PHP_EOL, FILE_APPEND);
$LINEDatas['token'] = "<YOUR-CHANNEL-ACCESS-TOKEN>";
<?php
$getParam = $_GET['liff_state'];
$paramUrlDecode = urldecode($getParam);
?>
<?php
require 'sendMessage.php';
$datas = [];
$datas["type"] = "flex";
$datas["altText"] = "This is a Flex Message";
$datas["contents"]["type"] = "carousel";
$datas["contents"]["contents"][0]["type"] = "bubble";
$datas["contents"]["contents"][0]["header"]["type"] = "box";
$datas["contents"]["contents"][0]["header"]["layout"] = "horizontal";
<?php
require 'sendMessage.php';
$flexDataJson = '';
$flexDataJsonDeCode = json_decode($flexDataJson,true);
$datas['url'] = "https://api.line.me/v2/bot/message/push";
$datas['token'] = "<access token>";
$messages['to'] = "<user id>";
$messages['messages'][] = $flexDataJsonDeCode;
<?php
require_once __DIR__ . '/vendor/autoload.php';
/*Get Data From POST Http Request*/
$datas = file_get_contents('php://input');
/*Decode Json From LINE Data Body*/
$deCode = json_decode($datas,true);
$client = new MongoDB\Client(
@aeknarinamn
aeknarinamn / line_group_webhook.php
Created September 24, 2022 08:19
LINE WEBHOOK BY GROUP
<?php
/*
LINE Example Webhook Group v.1
*/
/*Function Write File LOG*/
file_put_contents('log.txt', file_get_contents('php://input') . PHP_EOL, FILE_APPEND);
/*Get Data From POST Http Request*/
$datas = file_get_contents('php://input');
/*Decode Json From LINE Data Body*/
import { useEffect } from 'react'
import Logo from './../assets/logo.png'
import { useNavigate } from 'react-router-dom'
import API from './../services/HttpClient'
// import { liff } from 'react-liff';
import liff from '@line/liff'
// const liff = window.liff;
// const liffId = process.env.REACT_APP_LINE_LIFF_ID;