Answer the question
In order to leave comments, you need to log in
How to send photos and message via Telegram bot on Laravel?
I wrote this
foreach ($photos as $photo) {
$response = Telegram::sendPhoto([
'chat_id' => 'CHAT_ID',
'photo' => "https://domen.ru/{$photo}",
'caption' => ''
]);
$messageId[] = $response->getMessageId();
}
Telegram::sendMessage([
'chat_id' => $chat_id,
'text' => $reply,
'reply_markup' => $reply_markup
]);
local.ERROR: A path to local file, a URL, or a file resource should be uploaded using `Telegram\Bot\FileUpload\InputFile::create($pathOrUrlOrResource, $filename)` for `photo` property. Please view docs for example. {"exception":"[object] (Telegram\\Bot\\Exceptions\\CouldNotUploadInputFile(code: 0): A path to local file, a URL, or a file resource should be uploaded using `Telegram\\Bot\\FileUpload\\InputFile::create($pathOrUrlOrResource, $filename)` for `photo` property. Please view docs for example. at /var/www/u1240338/data/www/chpokepanel.xyz/rest/vendor/irazasyed/telegram-bot-sdk/src/Exceptions/CouldNotUploadInputFile.php:52)
Answer the question
In order to leave comments, you need to log in
Well, it’s clear because the message says what needs to be done:
$response = Telegram::sendPhoto([
'chat_id' => 'CHAT_ID',
'photo' => \Telegram\Bot\FileUpload\InputFile::create("https://domen.ru/{$photo}"),
'caption' => ''
]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question