<?php
require 'vendor/autoload.php';
use Telegram\Bot\Api;

$telegram = new Api('865606738:AAHgjA4fSxBwdVQ_j-qwVsHE_QoQ9kt7eSA');

$update = $telegram->getWebhookUpdates();

$telegram->sendPhoto([
    'chat_id' => '@sedaynab', 
    'photo' => $_POST["image_url"], 
    'caption' => "🗣 ".$_POST["artist"].PHP_EOL.
                "🔊 ".$_POST["title"].PHP_EOL.
                "🔎 #".str_replace(' ', '',  $_POST["artist"]).PHP_EOL.PHP_EOL.
                "📂 #New | 🆔 @sedaynab"
]);

file_put_contents("a.mp3", fopen($_POST["music_url"], 'r'));
require_once './phpmp3.php';
$mp3 = new mp3;
$mp3->cut_mp3('a.mp3', 'output.mp3', 0, 30, 'second', false);

$telegram->sendVoice([
  'chat_id' => '@sedaynab', 
  'voice' => 'output.mp3',
  'duration' => 30,
  'caption' => "🗣 ".$_POST["artist"].PHP_EOL.
                "🔊 ".$_POST["title"].PHP_EOL.
                "🔎 #".str_replace(' ', '',  $_POST["artist"]).PHP_EOL.PHP_EOL.
                "DEMO | 🆔 @sedaynab"
]);


$telegram->sendAudio([
  'chat_id' => '@sedaynab', 
  'audio' => $_POST["music_url"],
  'performer' => $_POST["artist"],
  'title' => $_POST["title"] . " @SedayNab" ,
  'caption' => "🗣 ".$_POST["artist"].PHP_EOL.
                "🔊 ".$_POST["title"].PHP_EOL.
                "🔎 #".str_replace(' ', '',  $_POST["artist"]).PHP_EOL.PHP_EOL.
                "MP3 | 🆔 @sedaynab"
]);
/*
$response = $telegram->sendMessage([
  'chat_id' => 315799454, 
  'text' => $_POST["artist"].PHP_EOL.$_POST["title"].PHP_EOL.$_POST["image_url"].PHP_EOL.$_POST["music_url"].PHP_EOL
]);*/

//$telegram->setAsyncRequest(true)->sendPhoto(['chat_id' => 'CHAT_ID', 'photo' => 'path/to/photo.jpg']);
?>