<?php
function sendTelegramPhoto($imagePath) {
    $token = TOKEN;
    $chat_id = CHATID;

    $post_fields = [
        'chat_id' => $chat_id,
        'photo' => new CURLFile($imagePath),
    ];

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://api.telegram.org/bot".$token."/sendPhoto");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
    $response = curl_exec($ch);
    curl_close($ch);
}
?>