How do you know the link to the picture sent to the telegram bot?

How do you know the link to the picture sent to the telegram bot from a user ?
Need to get a link to sent a picture, that would reship it to another site.
July 4th 19 at 23:51
1 answer
July 4th 19 at 23:53
Solution
After the user sends a photo message comes information about the picture, namely file_id (detailed here: https://core.telegram.org/bots/api#message )

Knowing file_id do request getFile (https://core.telegram.org/bots/api#getfile)
Get file_path

Next, make a request https://api.telegram.org/file/bot/ and get the image.
But such a link cannot be shown to the end user, because it specifies the token.
Thank you very much, I was about to leave. Another little question, how do I get file_id photo ? From the document it is passed along with the array, such as the same photo is transferred because if transferred photo in the json there is file_id, and how through the array to pull it writes null - alysa82 commented on July 4th 19 at 23:56
After downloading the pictures you create multiple variants (different sizes), so it will be a few file_id for images of different sizes.

data->photo[0]->file_id
data->photo[1]->file_id
data->photo[2]->file_id - jaunita_Yun commented on July 4th 19 at 23:59
: Yes helped, thanks again - alysa82 commented on July 5th 19 at 00:02

Find more questions by tags MessengersPHPTelegram