在电报机器人中发送来自 php url 的照片

Send a photo from php url in telegram bot

我正在尝试通过带有 telepot api 的 sendPhoto 方法 (https://core.telegram.org/bots/api#sendphoto) 使用电报机器人发送照片,但它只接受带有 .jpg 的图像 urls, .jpeg .gif、.png、.tif 或 .bmp 以及我要使用的照片通过 .php url 显示。我怎样才能设法获得有效的 url?我也可以使用 multipart/form-data 上传它,但它不起作用。

没关系,我设法做到了保存文件并使用

上传
urllib.request.urlretrieve("link.php", "./file.png")
bot.sendPhoto(chat_id, photo=open('./file.png', 'rb'))