Eleirbag89 / TelegramBotPHP

A very simple PHP Telegram Bot API for sending messages.
http://eleirbag89.github.io/TelegramBotPHP
MIT License
814 stars 343 forks source link

how to send pdf file #121

Closed saeed2922 closed 6 years ago

saeed2922 commented 6 years ago

here is my code but not work $content = array('chat_id' => $chat_id, 'document' => './invoices/Delivery Note.pdf'); $telegram->sendDocument($content);

Mohsen322 commented 6 years ago

Hi. Test full document address instead of relative address example: http://your-url.com/document.pdf

And be sure document size don't bigger than 50 Mb

saeed2922 commented 6 years ago

my pdf file is in localhost

Mohsen322 commented 6 years ago

You should upload the file or send it in multi part type and after upload u can send it easily. Upload is necessary. U cant send directly from local host. My telegram id: contact me @mohsen322Rezaei

saeed2922 commented 6 years ago

this work: fopen("./folder/$chat_id/");} $content = array('chat_id' =>$chat_id, 'document' =>$_FILES[$_SERVER['DOCUMENT_ROOT']. 'path/folder/$chat_id/DeliveryNote.pdf']); $telegram->sendDocument($content);