title: group send failed. telegram api bot, sendMediaGroup function
body: <p>in function input $files = $_FILES</p>
  
  <p>Don't get what Telegram wants from me.</p>
  
  <p>It says: "{"ok":false,"error_code":400,"description":"Bad Request: group send failed"}". HIELPLEAS!</p>
  
  <pre><code>function sendMediaGroup($files)
  {
      $url = "https://api.telegram.org/bot" . $this-&gt;token . "/" . __FUNCTION__;
      $media = [];
      $ch = curl_init();
      $type = "photo";
      $caption = "";
  
      foreach ($files as $file)
      {
          $media[] = [
              'type' =&gt; $type,
              'media' =&gt; $file['tmp_name'],
              'caption' =&gt; $caption
          ];
      }
  
      $disable_notification = false;
      $reply_to_message_id = null;
      $parameters = [
          'chat_id' =&gt; $this-&gt;chat_id,
          'media' =&gt; json_encode($media),
          'disable_notification' =&gt; $disable_notification,
          'reply_to_message_id' =&gt; $reply_to_message_id,
      ];
  
      curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type:multipart/form-data"));
      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters);
  
      return $output = curl_exec($ch);
  }
  </code></pre>