<?php require 'vendor/autoload.php'; use Sunra\PhpSimple\HtmlDomParser; $token = "153172554:AAGrcXguYssXQAwsM2M-YIvBL2RJS1fdgrk"; $client = new Zelenin\Telegram\Bot\Api($token); //$site = "https://api.telegram.org/bot".$token; $data = json_decode(file_get_contents('php://input'), true); $chatid = $data['message']['chat']['id']; $text = $data['message']['text']; $messageid = $data['message']['message_id']; $updateid = $data['update_id']; $senderid = $data['message']['from']['id']; $zaman = $data['message']['date']; if ($text == '/tatili' || $text == '/tatili@BeheshtiNotifierBot') { $news_page = HtmlDomParser::file_get_html("http://p-karaj.tvu.ac.ir/"); $elems = $news_page->find("#simple-list_11643 ", 0); $message = $elems->plaintext; $params = array('chat_id' => $chatid, 'action' => 'typing'); $response = $client->sendChatAction($params); $response = $client->sendMessage(array('chat_id' => $chatid, 'text' => $message, 'reply_to_message_id' => $messageid)); } if ($text == '/akhbar' || $text == '/akhbar@BeheshtiNotifierBot') { $news_page = HtmlDomParser::file_get_html("http://p-karaj.tvu.ac.ir/"); $elems = $news_page->find(".full-list article header a "); $link = $elems[0]->href; $fixLink = str_replace('./', '/', $link); //echo $fixLink; $behe = "http://p-karaj.tvu.ac.ir"; $url = $behe . $fixLink;
* GeeksWeb Bot (GWB) is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 * as published by the Free Software Foundation. * * GeeksWeb Bot (GWB) is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. <http://www.gnu.org/licenses/> * * Author(s): * * © 2015 Kasra Madadipouya <*****@*****.**> * */ require 'vendor/autoload.php'; $client = new Zelenin\Telegram\Bot\Api(''); // Set your access token $url = ''; // URL RSS feed $update = json_decode(file_get_contents('php://input')); //your app try { if ($update->message->text == '/email') { $response = $client->sendChatAction(['chat_id' => $update->message->chat->id, 'action' => 'typing']); $response = $client->sendMessage(['chat_id' => $update->message->chat->id, 'text' => "You can send email to : Kasra@madadipouya.com"]); } else { if ($update->message->text == '/help') { $response = $client->sendChatAction(['chat_id' => $update->message->chat->id, 'action' => 'typing']); $response = $client->sendMessage(['chat_id' => $update->message->chat->id, 'text' => "List of commands :\n /email -> Get email address of the owner \n /latest -> Get latest posts of the blog \n \t\t/help -> Shows list of available commands"]); } else { if ($update->message->text == '/latest') {
<?php //Some PHP Errors?! date_default_timezone_set('America/New_York'); //Start Coding ^_^ require 'vendor/autoload.php'; require 'config.php'; //Recive Data $data = json_decode(file_get_contents('php://input'), true); $jsondata = file_get_contents('php://input'); //Create Bot $client = new Zelenin\Telegram\Bot\Api($token); //Parse Recived Data $chatid = $data['message']['chat']['id']; $text = $data['message']['text']; $messageid = $data['message']['message_id']; $updateid = $data['update_id']; $senderid = $data['message']['from']['id']; $zaman = $data['message']['date']; $messageid = $data['message']['message_id']; // Initialize Database $db = new \MysqliDb($dbconf); // Insert Recived Data To Database $dbdata = array('ID' => '', 'Uid' => $updateid, 'Mid' => $messageid, 'Fid' => $senderid, 'Cid' => $chatid, 'Date' => $zaman, 'Text' => $text, 'Json' => $jsondata); $id = $db->insert('jadi_recived', $dbdata); $mp3 = "http://jadi.net/radiogeek.mp3"; switch ($text) { case '/podcast': case '/podcast@jadibot': case '/podcast@JadiBot': try {
<?php require 'vendor/autoload.php'; use Sunra\PhpSimple\HtmlDomParser; $token = "153172554:AAGrcXguYssXQAwsM2M-YIvBL2RJS1fdgrk"; //I know ! $client = new Zelenin\Telegram\Bot\Api($token); $data = json_decode(file_get_contents('php://input'), true); $chatid = $data['message']['chat']['id']; $text = $data['message']['text']; $messageid = $data['message']['message_id']; $updateid = $data['update_id']; $senderid = $data['message']['from']['id']; $user = $data['message']['from']['first_name']; $zaman = $data['message']['date']; $showKeyboard = new Zelenin\Telegram\Bot\Type\ReplyKeyboardMarkup(); $showKeyboard->keyboard = [['اخبار', 'تعطیلی کلاس ها'], ['کلاس جبرانی']]; $showKeyboard->one_time_keyboard = false; $showKeyboard->resize_keyboard = true; switch ($text) { // case 'اشتراک در خبرنامه': // case '/subscribe': // case '/subscribe@BeheshtiNotifierBot': // $params = array('chat_id' => $chatid, 'action' => 'typing'); // $response = $client -> sendChatAction($params); // $response = $client -> sendMessage(array('chat_id' => $chatid, 'text' => 'شما عضو خبرنامه شدید از اینک آخرین اخبار به شما ارسال میشود', 'reply_to_message_id' => $messageid)); // // $db = new PDO('pgsql:host=ec2-79-125-118-3.eu-west-1.compute.amazonaws.com // // ;dbname=d4p01vc87fpdr3','eswovxhrfxxvlu','-y1ZI2A6f8Q1hmIwBWOjLWzeNa'); // // $stmt = $db->prepare("INSERT INTO subscribess(NAME, chatid) VALUES (:NAME, :chatid)"); // // $stmt->bindParam(':NAME',$user , PDO::PARAM_STR); // // $stmt->bindParam(':chatid', $chatid, PDO::PARAM_INT);