Bu kodu kullanarak sohbet kimliği ile telgraf sohbete bir fotoğraf gönderebilirsiniz: Ben kanalın kimliğine chat_id
değerini değiştirirsenizTelegram bot ile telgraf kanalına nasıl fotoğraf gönderirim?
<?php
$bot_url = "https://api.telegram.org/bot<token-bot>/";
$ch = curl_init($bot_url.'SendPhoto');
$cfile = new CURLFile(realpath('file.png'),'image/png','photo.png');
$data = array(
'chat_id' => '118186395',
'photo' => $cfile ,
'caption' => 'testing'
);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
echo curl_exec($ch);
?>
Ama telgraftan boş cevap almak ve fotoğraf değildir gönderdi.
Botunuzun, göndermeye çalıştığınız kanalın yöneticisi olduğundan emin misiniz? – ixchi
evet mesaj gönderebiliyorum çünkü fotoğraf gönderemiyorum. –