我想用我的机器人以电报形式发送MP3文件,但有些文件返回400错误。敌人示例此URLhttp://www.dl.noisera.com/files/musics/1586023395/introhanditdown.mp3不是发送并返回400错误,但是这个URLhttp://www.dl.noisera.com/files/musics/1586023929/hardknocklifeghettoanthem.mp3发送。我的api代码是:
$url = 'https://api.telegram.org/bot'.$bot_id.'/sendDocument?chat_id='.$chat_id.'&document=http://www.dl.noisera.com/'.$_POST["musicFile"];
file_get_contents($url);
什么问题?
Telegram服务器存在缓存问题,它们的服务器要花费几个小时才能找到新链接。您应该使用服务器手动下载文件,并在收到该错误时将其上传。