function sendPhotoToUser($chatId, $photoUrl, $botToken) {
$url = "https://api.telegram.org/bot{$botToken}/sendPhoto";
$data = array(
'chat_id' => $chatId,
'photo' => $photoUrl
);
$ch = curl_init()
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$responseData = json_decode($response);
if ($responseData->ok) {
return true;
} else {
return false;
}
}