Closed aksus closed 6 years ago
Hi!
I'm sorry for the delayed response. I just tried with your example URL and I can indeed confirm that it doesn't work. However, it's not the module's fault - the error comes from the Telegram Bot API itself. It appears that for some reason your URL is not able to be reached from Telegram servers, or maybe there's some kind of protection/technical issue that isn't immediately visible.
For testing purposes I tried to request your URL with a Telegram-like user-agent (curl -A 'TelegramBot (like TwitterBot)' -I 'http://st.biglion.ru/r/w/600/h/340/cfs15/deal_offer/27/2a/272a8ea680ba17ef2243bebac9d711ea.jpg'
) and the response was exactly the same, thus testifying that probably there's not some kind of filtering being done server-side. Try by uploading the image somewhere else (e.g. imgur, or other image hosting websites) and see if it works by passing their direct URL.
As a last resort solution, you could also download the image using Perl, save it to a temporary location (or in-memory) and just stream it to the BotAPI, bypassing the "telegram-fetches-my-URL" step directly.
Let me know if you need further help or clarifications. Have a good day!
Thank you for your answer! I'm new at Perl. Can you tell where can I read how to download the image using Perl? (because some pdf have same trouble to) UPD: caught it!
File uploads can be specified using an hash reference containing the following mappings: file => '/path/to/file.ext' Path to the file you want to upload. Required only if the content is not specified. filename => 'file_name.ext' An optional filename that will be used instead of the real name of the file. Particularly recommended when content is specified. content => 'Being a file is cool :-)' The content of the file to send. When using this, file must not be specified. AnyCustom => 'Header' Custom headers can be specified as hash mappings.
May the Force be with you!)
Hello,
Glad that you were able to do it! If you need further help, feel free to ask :)
Thanks for using the module! Have a good day. Roberto
Hi! Sometimes there is a problem with using sendPhoto and sendDocument: (the code is simple to not)
_$method = "sendPhoto"; $api->$method ({ chat_id => $u->{message}{chat}{id}, photo => "http://st.biglion.ru/r/w/600/h/340/cfs15/deal_offer/27/2a/272a8ea680ba17ef2243bebac9d711ea.jpg" });_
ERROR: code 400: Bad Request: wrong file identifier/HTTP URL specified at /usr/local/share/perl5/WWW/Telegram/BotAPI.pm line 208
Mime-types are correct. I do not understand the cause of this misfortune.