Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/237.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP电报机器人(editMessageText和editReplyMarkup)_Php_Telegram_Telegram Bot_Php Telegram Bot_Telegram Webhook - Fatal编程技术网

PHP电报机器人(editMessageText和editReplyMarkup)

PHP电报机器人(editMessageText和editReplyMarkup),php,telegram,telegram-bot,php-telegram-bot,telegram-webhook,Php,Telegram,Telegram Bot,Php Telegram Bot,Telegram Webhook,我是Kevin,最近我在函数editMessageText和editReplyMarkup方面遇到了问题。这是我的代码,我不知道问题出在哪里 这是我的代码: <?php $botToken = "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; $website = "https://api.telegram.org/bot".$botToken; $FilejSon = file_get_contents("php://input");

我是Kevin,最近我在函数
editMessageText
和editReplyMarkup方面遇到了问题。这是我的代码,我不知道问题出在哪里

这是我的代码:

<?php

$botToken = "XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$website = "https://api.telegram.org/bot".$botToken;

$FilejSon = file_get_contents("php://input"); 
$FilejSon = json_decode($FilejSon, TRUE); 

$FirstName = $FilejSon["message"]["chat"]["first_name"];
$UserChatId = $FilejSon["message"]["chat"]["id"];
$Message = $FilejSon["message"]["text"];
$MessageID = $FilejSon["message"]["message_id"];

$CallBackID = $FilejSon["callback_query"]["from"]["id"];
$CallBackData = $FilejSon["callback_query"]["data"];
$what = ["callback_query"]["message"]["inline_message_id"];


$document = "http://media.giphy.com/media/109Ku3hdapZJle/giphy.gif"; //It's just a funny image

                //Emoji
    $phone = json_decode('"\uD83D\uDCF2"');
    $list = json_decode('"\uD83D\uDCCB"');
    $money = json_decode('"\uD83D\uDCB0"');
    $postbox = json_decode('"\uD83D\uDCEE"');
    $sos = json_decode('"\uD83C\uDD98"');
    $link = json_decode('"\uD83D\uDD17"');

    $jSonCodeKeyboard = '&reply_markup={"inline_keyboard":[[{"text":"1","url":"https://core.telegram.org/bots/api"}],[{"text":"2","url":"https://www.google.it"}],[{"text":"4","switch_inline_query_current_chat":"try"}],[{"text":"5","url":"https://www.google.it"},{"text":"'.$link.'%20Link%20'.$link.'","url":"http://botkevin.altervista.org/Bot/Nuovo_documento_di_testo.txt"}],[{"text":"6","callback_data":"Press"}]]}';
    $jSonCodeKeyboard1 = '&reply_markup={"inline_keyboard":[[{"text":"Indietro","callback_data":"Ok"}]]}';

switch ($Message){
    case '/start':
        $msg = "Hello $GLOBALS[FirstName] $GLOBALS[MessageID] $GLOBALS[UserChatId] $GLOBALS[what].\n";
        sendMessage($UserChatId, $msg, $jSonCodeKeyboard);
        break;

    case '/prova':
        sendFile($UserChatId, $document);
        break;

    case '/prova1':
        $msg = "worked $GLOBALS[MessageID]";
        sendMessage($UserChatId, $msg, $jSonCodeKeyboard1);    
        break;

    default:
        if (callback($FilejSon)){
            if ($CallBackData == "Press"){
                sendMessage($CallBackID, "gg", $jSonCodeKeyboard1);
            }
            else if($CallBackData == "Ok")
            {
                $msg = "Edited";
                Edit($CallBackID, $MessageID, $msg);
                Edit1($CallBackID, $MessageID, $jSonCodeKeyboard1);
            }
        }

        $msg = "Unrecognized command.";
        sendMessage($UserChatId, $msg);
        break;
} 

function sendMessage($chat_id, $text, $LayoutKey){
    if($LayoutKey==""){
    $url = $GLOBALS[website]."/sendMessage?chat_id=".$chat_id."&text=".urlencode($text);
    file_get_contents($url);
    }
    else{
    $url = $GLOBALS[website]."/sendMessage?chat_id=".$chat_id."&text=".urlencode($text).$LayoutKey;
    file_get_contents($url);
    }
}

function sendFile($chat_id, $file){
    $url = $GLOBALS[website]."/sendDocument?chat_id=".$chat_id."&document=".$file;  //Gif,Pdf e Zip
    file_get_contents($url);
}

function Edit($chat_id, $msgID, $text){
    $url = $GLOBALS[website]."/editMessageText?chat_id=".$chat_id."&message_id=".$msgID."&text=".urlencode($text);
    file_get_contents($url);
}

function Edit1($chat_id, $msgID, $LayoutKey){
    $url = $GLOBALS[website]."/editMessageReplyMarkup?chat_id=".$chat_id."&message_id=".$msgID.$jSonCodeKeyboard1;
    file_get_contents($url);
}

function callback($getUpdate){
    return $getUpdate["callback_query"];
}?>