<?php
header("Content-Type: application/json");

// শুধুমাত্র POST allow
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
    echo json_encode([
        "success" => false,
        "message" => "Invalid request method"
    ]);
    exit;
}

// JSON input পড়া
$input = json_decode(file_get_contents("php://input"), true);

$ubrn = $input['ubrn'] ?? '';
$dob  = $input['dob'] ?? '';

// validation
if (empty($ubrn) || empty($dob)) {
    echo json_encode([
        "success" => false,
        "message" => "UBRN and DOB required"
    ]);
    exit;
}

// Example (fake data check)
if ($ubrn === "20042692075056285" && $dob === "2004-04-04") {
    echo json_encode([
        "success" => true,
        "data" => [
            "name" => "Test User",
            "dob" => $dob
        ]
    ]);
} else {
    echo json_encode([
        "success" => false,
        "message" => "Invalid data"
    ]);
}