Telegram-Php


<?php
error_reporting(0);
define('BOT_TOKEN', '000000000:AAAAAAAAAAAAAAAAAAAAAaaa');
define('API_URL', 'https://api.telegram.org/bot'.BOT_TOKEN.'/');


//////start bot telegram////////////
// read incoming info and grab data
$content = file_get_contents("php://input");
$update = json_decode($content, true);
$chatID = $update["message"]["chat"]["id"];
$ch_type = $update["message"]["chat"]["type"];
define('CHATID',$chatID);
$chatN = $update["message"]["from"]["username"];
$noxID = $update["message"]["from"]["id"];
define('NOXID',$noxID);
define('CHATN',$chatN);
$chatT = strtolower($update["message"]["text"]);
$msgID = $update["message"]["message_id"];
$chatN2 = $update["message"]["from"]["first_name"];
$usID = $update["message"]["from"]["id"];

$ss = "Format Perintah\nKODE_PT#KODE_PRODI#NO_IJAZAH\nContoh :\n141001#55202#692012018000352\n\n";
$sta = "Cari KODE_PT/KODE_PRODI :\nPT[SPASI]NAMA PERGURUAN TINGGI\nContoh :\npt universitas hasanuddin\n\n";
$st2 = "Cari Berdasarkan NIM :\nNIM[SPASI]NIM MAHASISWA\nContoh :\nnim 02530107";
$ss = $ss.$sta.$st2;

if ($chatT=="/help") { file_get_contents(API_URL."sendmessage?chat_id=".CHATID."&text=".urlencode($ss)); }

if (mb_substr($chatT, 0, 3)=="pt " ) { 
    $ch1=explode("pt ",$chatT);
	$nama1 = $ch1[1];
	aaaaaaa($nama1);
	exit();

}elseif (mb_substr($chatT, 0, 4)=="nim ") {	
	bbbbbbb($chatT);
	exit();

}elseif (mb_substr($chatT, 0, 8)=="/detail_") {	
	cccccccc($chatT);
	exit();

 }


?>