PHP'den gelen veriyi Telegram'a nasıl gönderirim? (1 Viewer)

Joined
Aug 4, 2022
Credits
130
Rating - 0%
Merhaba, ben bir form oluşturdum fakat bu bilgileri telegramdan mesaj olarak almak istiyorum nasıl yapılıyor?
 

SkullZ 

anlamazdin.py
Joined
Apr 21, 2016
Credits
134,298
Rating - 100%
Merhaba,

Form'daki input isimlerini, diğer sayfaya post ettikten sonra Yapacağın İşlem aşağıdaki gibidir;

BotFather kullanarak bir bot oluşturun. Daha sonra onun size vereceği ID'i alın.
Bir grup oluşturun ve gruba Get My Chat ID (@GetMyChatID_Bot) botunu ekleyiniz.
Aldığınız bot ID ve chat ID'i aşağıdaki koda giriniz ve aşağıdaki kodu post edilen yere yapıştırınız. Örneğin iki sayfa;

index.php
HTML:
<form action="post.php" method="POST">
    <input type="text" name="isim">
    <input type="text" name="soyisim">
    <input type="submit">
</form>

post.php
PHP:
<?php
$token = "BOTFATHER'DAN ALINAN ID'İ YAZINIZ";
$mesaj = " Merhaba, Yeni bir Kullanıcımız var!
           İsim: ".$_POST["isim"]. "
         Soyisim: ".$_POST["soyisim"]. "
         IP Adresi: ".$_SERVER["REMOTE_ADDR"]."";
$parametre= array(
'chat_id' => "GET MY CHATID'DEN ALINAN İD'İ YAZINIZ.",
'text' => $mesaj ,
);
$ch = curl_init();
$url = "https://api.telegram.org/bot".$token."/sendmessage";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $parametre);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
?>
 

Users who are viewing this thread

Top