<?php
require 'includes/ProxyHelper.php';
$helper = new ProxyHelper();

function test($name, $url, $method = 'GET', $postData = [], $isJson = false) {
    global $helper;
    echo "=== $name ===\nURL: $url\n";
    $headers = [];
    $res = $helper->fetch($url, $method, $postData, $isJson, 'https://bdris.gov.bd/', $headers);
    echo "HTTP: " . $res['http_code'] . "\n";
    echo "Response: " . substr($res['body'], 0, 500) . "\n\n";
}

$sparams = [
    'draw' => 1,
    'columns' => [['data' => 'applicationId', 'name' => '', 'searchable' => true, 'orderable' => true, 'search' => ['value' => '', 'regex' => false]]],
    'order' => [['column' => 0, 'dir' => 'asc']],
    'start' => 0,
    'length' => 10,
    'search' => ['value' => '262246869', 'regex' => false]
];

test('App GET Query Full', 'https://bdris.gov.bd/api/br/applications/search?' . http_build_query($sparams));
test('UBRN + DOB dd/MM/yyyy GET', 'https://bdris.gov.bd/api/br/user-search-by-ubrn-and-dob?ubrn=19943216719120280&personBirthDate=26/02/1994');
test('NID Check dd/MM/yyyy', 'https://bdris.gov.bd/api/uid/get-nid-verification-by-nid-dob-data-group?nid=8268076380&dob=16/06/1995&dataGroup=1');

