【发布时间】:2019-11-08 21:01:50
【问题描述】:
我使用此代码通过 BOT 发送图像 https://stackoverflow.com/a/32296353/6017365,一切都很好:
$bot_url = "https://api.telegram.org/bot<bot_id>/";
$url = $bot_url . "sendPhoto?chat_id=" . $chat_id ;
$post_fields = array('chat_id' => $chat_id,
'photo' => new CURLFile(realpath("/path/to/image.png"))
);
$ch = curl_init();
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, $post_fields);
$output = curl_exec($ch);
然后我修改它以发送带有sendVideo和video参数的gif。
现在我想编辑文件以发送带有 gif 作为附件的普通文本....我尝试在数组中添加 text 参数,但只收到图像...
有什么建议吗?
【问题讨论】:
-
尝试使用
caption而不是text(文本用于短信,标题用于照片、视频和相册)