File manager - Edit - /home/cipherteam/htdocs/cipherteam.in/APPS/CronJobs/Kfintech/CheckAllotmentUsingPan.php
Back
<?php ini_set('display_errors', 1); error_reporting(E_ALL); /* ================= INPUT ================= */ // PANs separated by comma $panInput = isset($_GET['pan']) ? strtoupper(trim($_GET['pan'])) : ""; if ($panInput === "") { $panInput = "AUGPP8910N"; // default for testing } // Convert to array $pans = array_unique(array_filter(array_map('trim', explode(',', $panInput)))); /* ================= API CONFIG ================= */ $apiUrl = "https://0uz601ms56.execute-api.ap-south-1.amazonaws.com/prod/api/query?type=pan"; $baseHeaders = [ 'accept: application/json, text/plain, */*', 'access-control-allow-origin: *', 'client_id: 67910895430', 'origin: https://ipostatus.kfintech.com', 'referer: https://ipostatus.kfintech.com/', 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36' ]; /* ================= HELPERS ================= */ function fetchAllotment($pan, $apiUrl, $baseHeaders) { $headers = $baseHeaders; $headers[] = 'reqparam: ' . $pan; $ch = curl_init(); curl_setopt_array($ch, [ CURLOPT_URL => $apiUrl, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 30, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTPHEADER => $headers, ]); $response = curl_exec($ch); $error = curl_error($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($response === false) { return ['error' => $error, 'http' => $httpCode]; } $json = json_decode($response, true); if (!is_array($json)) { return ['error' => 'Invalid JSON', 'http' => $httpCode]; } // Extract record safely $rec = []; if (isset($json['data'][0])) { $rec = $json['data'][0]; } return [ 'http' => $httpCode, 'record' => $rec, 'raw' => $json ]; } /* ================= PROCESS ================= */ $rows = []; foreach ($pans as $pan) { $res = fetchAllotment($pan, $apiUrl, $baseHeaders); if (isset($res['error'])) { $rows[] = [ 'Application Number' => '', 'Name' => '', 'DP ID Client ID' => '', 'PAN' => $pan, 'Applied' => '', 'Allotted' => '', 'Status' => 'ERROR' ]; continue; } $r = $res['record']; $appNo = (string)($r['Appln_No'] ?? ''); $name = (string)($r['Name'] ?? ''); $dpclid = (string)($r['DP_CLID'] ?? ''); $panOut = (string)($r['Pan_No'] ?? $pan); $applied = (string)($r['App_Shares'] ?? ''); $allotted = (string)($r['All_Shares'] ?? ''); // Determine status if ( $appNo === '' && $name === '' && $dpclid === '' && $applied === '' && $allotted === '' ) { $status = 'Not Applied'; } else { $allottedNum = (int)preg_replace('/\D+/', '', $allotted); $status = ($allottedNum > 0) ? 'Allotted' : 'Not Allotted'; } $rows[] = [ 'Application Number' => $appNo, 'Name' => $name, 'DP ID Client ID' => $dpclid, 'PAN' => $panOut, 'Applied' => $applied, 'Allotted' => $allotted, 'Status' => $status ]; } /* ================= UI ================= */ ?> <!DOCTYPE html> <html> <head> <title>IPO Allotment Status</title> <meta charset="utf-8"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"> <style> body { background:#f5f7fb; } .table th { white-space: nowrap; } .badge-allotted { background:#198754; } .badge-not { background:#dc3545; } </style> </head> <body> <div class="container mt-4"> <h3 class="mb-3 text-center">IPO Allotment Status</h3> <div class="card shadow-sm"> <div class="card-body p-0"> <table class="table table-bordered table-hover mb-0"> <thead class="table-dark"> <tr> <th>Application Number</th> <th>Name</th> <th>DP ID Client ID</th> <th>PAN</th> <th>Applied</th> <th>Allotted</th> <th>Status</th> </tr> </thead> <tbody> <?php foreach ($rows as $row): ?> <tr> <td><?= htmlspecialchars($row['Application Number']) ?></td> <td><?= htmlspecialchars($row['Name']) ?></td> <td><?= htmlspecialchars($row['DP ID Client ID']) ?></td> <td><?= htmlspecialchars($row['PAN']) ?></td> <td><?= htmlspecialchars($row['Applied']) ?></td> <td><?= htmlspecialchars($row['Allotted']) ?></td> <td> <?php if ($row['Status'] === 'Allotted'): ?> <span class="badge badge-allotted">Allotted</span> <?php elseif ($row['Status'] === 'Not Allotted'): ?> <span class="badge badge-not">Not Allotted</span> <?php elseif ($row['Status'] === 'Not Applied'): ?> <span class="badge bg-warning text-dark">Not Applied</span> <?php else: ?> <span class="badge bg-secondary"><?= htmlspecialchars($row['Status']) ?></span> <?php endif; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> </div> <p class="mt-3 text-muted"> Total PAN Checked: <strong><?= count($rows) ?></strong> </p> </div> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.2.9 | Generation time: 0.09 |
proxy
|
phpinfo
|
Settings