title: PHP Telegram Bot (editMessageText & editReplyMarkup)
body: <p>I am Kevin and these days I'm having problems with the functions <code>editMessageText</code> and editReplyMarkup. This is my code and I don't know where is the problem.</p>
  
  <p>This is my code: </p>
  
  <pre><code>&lt;?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 = '&amp;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 = '&amp;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."&amp;text=".urlencode($text);
      file_get_contents($url);
      }
      else{
      $url = $GLOBALS[website]."/sendMessage?chat_id=".$chat_id."&amp;text=".urlencode($text).$LayoutKey;
      file_get_contents($url);
      }
  }
  
  function sendFile($chat_id, $file){
      $url = $GLOBALS[website]."/sendDocument?chat_id=".$chat_id."&amp;document=".$file;  //Gif,Pdf e Zip
      file_get_contents($url);
  }
  
  function Edit($chat_id, $msgID, $text){
      $url = $GLOBALS[website]."/editMessageText?chat_id=".$chat_id."&amp;message_id=".$msgID."&amp;text=".urlencode($text);
      file_get_contents($url);
  }
  
  function Edit1($chat_id, $msgID, $LayoutKey){
      $url = $GLOBALS[website]."/editMessageReplyMarkup?chat_id=".$chat_id."&amp;message_id=".$msgID.$jSonCodeKeyboard1;
      file_get_contents($url);
  }
  
  function callback($getUpdate){
      return $getUpdate["callback_query"];
  }?&gt;
  </code></pre>
  
  <p>I've searched everywhere a solution but either were in another programming language or used a library and more, I'm not very good at php so i would like a basic thing like my code.</p>
  
  <p>I would like to do that when I click on the inline keyboard of the first message that sends the bot by doing "/ start", clicking a button can modify the message and the inline keyboard without sending other messages clogging the chat.</p>
  
  <p>(already checked <a href="https://core.telegram.org/bots/api" rel="nofollow noreferrer">https://core.telegram.org/bots/api</a>)</p>