File manager - Edit - /home/cipherteam/htdocs/cipherteam.in/API/ew/AllTimeLow.php
Back
<?php // DataGetter/AllTimeLow.php header('Access-Control-Allow-Origin: https://sharemarketipo.in'); header('Access-Control-Allow-Methods: GET'); header('Access-Control-Allow-Headers: Content-Type'); $exc = isset($_GET['exc']) ? $_GET['exc'] : 'NSE'; $index = isset($_GET['index']) ? $_GET['index'] : '-44'; $prd = '1D'; $apiUrl = 'https://nw.nuvamawealth.com/edelmw-content/content/new-equity/all-time-high-low' . '?type=low' . '&exc=' . rawurlencode($exc) . '&index=' . $index . '&period=' . $prd; /* -------------------- Robust fetch: real timeouts + one retry -------------------- */ $response = false; $httpCode = null; $curlErr = null; for ($attempt = 1; $attempt <= 2; $attempt++) { $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $apiUrl, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 8, CURLOPT_CONNECTTIMEOUT => 5, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'accept: */*', 'accept-language: en-US,en;q=0.9,gu;q=0.8', 'appidkey: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHAiOjEsImZmIjoiVyIsImJkIjoid2ViLXBjIiwibmJmIjoxNTc5MjQxODMyLCJzcmMiOiJlbXRtdyIsImF2IjoiMS4wLjAuNCIsImFwcGlkIjoiNGZlNjhiNzUzNjc4NGUzNDA3YzNlY2YxOWJlN2M0YWQiLCJpc3MiOiJlbXQiLCJleHAiOjE2MTA3NzgxMzIsImlhdCI6MTU3OTI0MjEzMn0.IR-PKf1Jjr69bsERFmMeuZrZ2RafBDiTGgKA6Ygofdo', 'content-type: application/json', 'origin: https://www.nuvamawealth.com', 'referer: https://www.nuvamawealth.com/', 'source: EDEL', 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36', ), )); $response = curl_exec($curl); $errno = curl_errno($curl); $curlErr = curl_error($curl); $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); if ($errno === 0 && $httpCode === 200 && !empty($response)) break; if ($errno === 0 && $httpCode !== 0 && $httpCode < 500) break; } if ($curlErr || $httpCode !== 200 || empty($response)) { echo '<div class="empty"><div class="empty__icon">i</div><div class="empty__text">Connection Error</div><div class="empty__sub">Could not reach data source.</div></div>'; exit; } $data = json_decode($response, true); // Same path as AllTimeHigh — API typo: allTimeHghLw (not allTimeLowLw) $rows = $data['data']['allTimeHghLw'] ?? []; if (empty($rows)): ?> <div class="empty"> <div class="empty__icon">i</div> <div class="empty__text">No Data Found</div> <div class="empty__sub">Please try a different filter.</div> </div> <?php else: foreach ($rows as $i => $row): $name = htmlspecialchars(trim($row['cname'] ?? ''), ENT_QUOTES); $ltp = htmlspecialchars($row['ltp'] ?? '', ENT_QUOTES); $chng = floatval($row['chg'] ?? 0); $chngPer = floatval($row['chgP'] ?? 0); $rank = $i + 1; $delay = number_format(min($i, 20) * 0.03, 2); if ($chng > 0) { $dir = 'up'; $pctLabel = '+' . number_format($chngPer, 2) . '%'; $absLabel = '+' . number_format($chng, 2); } elseif ($chng < 0) { $dir = 'down'; $pctLabel = number_format($chngPer, 2) . '%'; $absLabel = number_format($chng, 2); } else { $dir = 'flat'; $pctLabel = '0.00%'; $absLabel = '0.00'; } ?> <div class="sr" style="animation-delay:<?php echo $delay; ?>s"> <div class="sr__rank"><?php echo $rank; ?></div> <div class="sr__name"><?php echo $name; ?></div> <div class="sr__ltp"><?php echo $ltp; ?></div> <div class="sr__change"> <span class="sr__pct sr__pct--<?php echo $dir; ?>"> <?php if ($dir === 'up'): ?> <svg class="sr__arrow" viewBox="0 0 10 10"><polyline points="2,7 5,3 8,7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg> <?php elseif ($dir === 'down'): ?> <svg class="sr__arrow" viewBox="0 0 10 10"><polyline points="2,3 5,7 8,3" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg> <?php else: ?> <svg class="sr__arrow" viewBox="0 0 10 10"><line x1="2" y1="5" x2="8" y2="5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg> <?php endif; ?> <?php echo $pctLabel; ?> </span> <span class="sr__abs sr__abs--<?php echo $dir; ?>"><?php echo $absLabel; ?></span> </div> </div> <?php endforeach; endif; ?> <style> .sr { display:-webkit-box; display:-webkit-flex; display:-ms-flexbox; display:flex; -webkit-box-align:center; -webkit-align-items:center; -ms-flex-align:center; align-items:center; padding:10px 14px 10px 12px; border-bottom:1px solid var(--accent-hair); gap:10px; animation:rowIn .3s ease backwards; -webkit-transition:background .15s ease; transition:background .15s ease; } .sr:last-child { border-bottom:none; } .sr:hover { background:var(--accent-softer); } @keyframes rowIn { from { opacity:0; -webkit-transform:translateX(-5px); transform:translateX(-5px); } to { opacity:1; -webkit-transform:translateX(0); transform:translateX(0); } } .sr__rank { width:20px; -webkit-flex-shrink:0; flex-shrink:0; font-family:'JetBrains Mono',monospace; font-size:10px; font-weight:600; color:var(--accent-light); text-align:center; line-height:1; } .sr__name { -webkit-box-flex:1; -webkit-flex:1; flex:1; min-width:0; font-family:'DM Sans',sans-serif; font-size:13px; font-weight:500; color:var(--accent-deep); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } .sr__ltp { -webkit-flex-shrink:0; flex-shrink:0; width:64px; text-align:right; font-family:'JetBrains Mono',monospace; font-size:12px; font-weight:600; color:var(--ink); letter-spacing:-0.01em; } .sr__change { -webkit-flex-shrink:0; flex-shrink:0; width:84px; display:-webkit-box; display:-webkit-flex; display:-ms-flexbox; display:flex; -webkit-box-orient:vertical; -webkit-box-direction:normal; -webkit-flex-direction:column; flex-direction:column; -webkit-box-align:end; -webkit-align-items:flex-end; align-items:flex-end; gap:2px; } .sr__pct { display:-webkit-inline-box; display:-webkit-inline-flex; display:inline-flex; -webkit-box-align:center; -webkit-align-items:center; align-items:center; gap:3px; font-family:'JetBrains Mono',monospace; font-size:11px; font-weight:700; padding:3px 8px 3px 5px; border-radius:999px; white-space:nowrap; letter-spacing:-0.02em; line-height:1; } .sr__pct--up { color:var(--buy); background:var(--buy-bg); } .sr__pct--down { color:var(--sell); background:var(--sell-bg); } .sr__pct--flat { color:var(--ink-3); background:var(--accent-soft); } .sr__arrow { width:10px; height:10px; -webkit-flex-shrink:0; flex-shrink:0; } .sr__abs { font-family:'JetBrains Mono',monospace; font-size:9.5px; font-weight:500; letter-spacing:-0.01em; opacity:0.55; white-space:nowrap; padding-right:2px; } .sr__abs--up { color:var(--buy); } .sr__abs--down { color:var(--sell); } .sr__abs--flat { color:var(--ink-3); } .empty { padding:30px 20px; text-align:center; } .empty__icon { width:48px; height:48px; margin:0 auto 12px; border-radius:50%; background:var(--accent); color:#fff; display:-webkit-box; display:-webkit-flex; display:flex; -webkit-box-align:center; align-items:center; -webkit-box-pack:center; justify-content:center; font-family:'Fraunces',serif; font-size:24px; font-style:italic; } .empty__text { font-family:'Fraunces',serif; font-size:16px; color:var(--accent-deep); font-weight:500; } .empty__sub { margin-top:4px; font-size:12px; color:var(--accent-dark); opacity:0.75; } </style>
| ver. 1.4 |
Github
|
.
| PHP 8.2.9 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings