Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sendPicture($id, "picture.png");
- function sendPicture($_chatID, $file_on_server){
- $target_url = 'https://api.telegram.org/**<YOUR TOKEN HERE>**/sendphoto';
- $file_name_with_full_path = realpath('./'.$file_on_server);
- $post = array(
- 'chat_id' => $_chatID,
- 'photo' => '@'.$file_name_with_full_path
- );
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL,$target_url);
- curl_setopt($ch, CURLOPT_POST,1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
- $result=curl_exec ($ch);
- curl_close ($ch);
- echo $result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement