There is a function

function getFile($file_id) { $file_path_array = json_decode(file_get_contents($GLOBALS['api'] . '/getFile?file_id=' . $file_id), TRUE); $file_path = $file_path_array['result']['file_path']; $file_path_url = 'https://api.telegram.org/file/bot00037100:XXXkXU9L8DXXXXXUSY0R36XXCQ9d3XXXX/'.$file_path; return $file_path_url; } 

It processes the format array.

 {"ok":true,"result":{"file_id":"XXXXqcxGwyaYxXXXXXVvITMmrQ4ABOlO5XXX1KQBAXXX","file_size":47984,"file_path":"photos/file_0.jpg"}} 

For some reason, it can digest the values ​​of file_id and file_size, but the file_path that’s necessary to categorically refuses

  • var_dump (getFile ($ file_id)); what returns? - sterx
  • So you do not execute the $file_path_url , you just output it where file_get_contents ? - Let's say Pie
  • I do this $ url = getFile ('HERE ID') ;. I tried to take file_size or file_id for file_path, they are displayed, but there is no file_path, what's stopping? - ajaxxx

0