File manager - Edit - /home/cipherteam/htdocs/cipherteam.in/API/ew/AdvanceDecline.php
Back
<?php // DataGetter/AdvanceDecline.php header('Access-Control-Allow-Origin: https://sharemarketipo.in'); header('Access-Control-Allow-Methods: GET'); header('Access-Control-Allow-Headers: Content-Type'); if (isset($_GET['exc'])) $exc = $_GET['exc']; else $exc = 'NSE'; /* -------------------- Robust fetch: real timeouts + one retry -------------------- */ $apiUrl = 'https://nw.nuvamawealth.com/edelmw-content/content/new-equity/advance-decline-view-all?exc=' . urlencode($exc); $response = false; $httpCode = null; $lastErr = 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,zh-TW;q=0.7,zh;q=0.6', 'appidkey: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHAiOjEsImZmIjoiVyIsImJkIjoid2ViLXBjIiwibmJmIjoxNTc5MjQxODMyLCJzcmMiOiJlbXRtdyIsImF2IjoiMS4wLjAuNCIsImFwcGlkIjoiNGZlNjhiNzUzNjc4NGUzNDA3YzNlY2YxOWJlN2M0YWQiLCJpc3MiOiJlbXQiLCJleHAiOjE2MTA3NzgxMzIsImlhdCI6MTU3OTI0MjEzMn0.IR-PKf1Jjr69bsERFmMeuZrZ2RafBDiTGgKA6Ygofdo', 'content-type: application/json', 'origin: https://www.nuvamawealth.com', 'priority: u=1, i', 'referer: https://www.nuvamawealth.com/', 'sec-ch-ua: "Chromium";v="148", "Google Chrome";v="148", "Not/A)Brand";v="99"', 'sec-ch-ua-mobile: ?0', 'sec-ch-ua-platform: "Windows"', 'sec-fetch-dest: empty', 'sec-fetch-mode: cors', 'sec-fetch-site: same-site', '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); $lastErr = curl_error($curl); $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); if ($errno === 0 && $httpCode === 200 && !empty($response)) { break; // success } if ($errno === 0 && $httpCode !== 0 && $httpCode < 500) { break; // non-5xx rejection (e.g. 403) — not retryable, stop immediately } // else: transient (timeout / 5xx) — loop retries once more } $data = ($httpCode === 200 && !empty($response)) ? json_decode($response, true) : null; $rows = is_array($data) ? ($data['data']['adList'] ?? []) : []; ?> <div class="table-card"> <div class="tbl-head"> <div class="tbl-head__col tbl-head__col--name">Index</div> <div class="tbl-head__col tbl-head__col--adv">Advance</div> <div class="tbl-head__col tbl-head__col--dec">Decline</div> </div> <?php if (empty($rows)): ?> <div class="ad-empty"> <div class="ad-empty__icon">i</div> <div class="ad-empty__text">No Data Found</div> <div class="ad-empty__sub">Try switching the exchange.</div> </div> <?php else: ?> <?php foreach ($rows as $i => $list): $name = htmlspecialchars($list['dpName'] ?? '', ENT_QUOTES); $adv = intval($list['advance'] ?? 0); $dec = intval($list['decline'] ?? 0); $total = $adv + $dec; $advPct = $total > 0 ? round(($adv / $total) * 100) : 50; $decPct = 100 - $advPct; $delay = number_format(min($i, 20) * 0.04, 2); ?> <div class="tbl-row" style="animation-delay:<?php echo $delay; ?>s"> <div class="tbl-row__name-cell"> <div class="tbl-row__name"><?php echo $name; ?></div> <div class="ad-bar"> <div class="ad-bar__adv" style="width:<?php echo $advPct; ?>%"></div> <div class="ad-bar__dec" style="width:<?php echo $decPct; ?>%"></div> </div> <div class="ad-bar__labels"> <span class="ad-bar__label ad-bar__label--adv">▲ <?php echo $advPct; ?>%</span> <span class="ad-bar__label ad-bar__label--dec"><?php echo $decPct; ?>% ▼</span> </div> </div> <div class="tbl-row__num tbl-row__num--adv"><?php echo number_format($adv); ?></div> <div class="tbl-row__num tbl-row__num--dec"><?php echo number_format($dec); ?></div> </div> <?php endforeach; ?> <?php endif; ?> </div> <style> .tbl-row { display: flex; align-items: center; gap: 8px; padding: 11px 14px 11px 18px; border-bottom: 1px solid var(--accent-hair); transition: background .15s ease; animation: adSlideUp .5s ease backwards; } .tbl-row:last-child { border-bottom: none; } .tbl-row:hover { background: var(--accent-softer); } @keyframes adSlideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } } .tbl-row__name-cell { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; } .tbl-row__name { font-family: 'Fraunces', serif; font-size: 14px; font-weight: 500; letter-spacing: -0.01em; color: var(--accent-deep); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 8px; } .tbl-row__num { width: 60px; flex-shrink: 0; text-align: center; font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600; letter-spacing: -0.01em; line-height: 1; } .tbl-row__num--adv { color: var(--buy); } .tbl-row__num--dec { color: var(--sell); } .ad-bar { height: 5px; border-radius: var(--radius-pill); overflow: hidden; background: var(--accent-softer); display: flex; } .ad-bar__adv { height: 100%; background: var(--buy); border-radius: var(--radius-pill) 0 0 var(--radius-pill); transition: width .4s ease; } .ad-bar__dec { height: 100%; background: var(--sell); border-radius: 0 var(--radius-pill) var(--radius-pill) 0; transition: width .4s ease; } .ad-bar__labels { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; } .ad-bar__label { font-family: 'JetBrains Mono', monospace; font-size: 9px; font-weight: 700; opacity: 0.75; } .ad-bar__label--adv { color: var(--buy); } .ad-bar__label--dec { color: var(--sell); } .ad-empty { padding: 30px 20px; text-align: center; border-top: 1px solid var(--accent-hair); } .ad-empty__icon { width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-family: 'Fraunces', serif; font-size: 24px; font-style: italic; } .ad-empty__text { font-family: 'Fraunces', serif; font-size: 16px; color: var(--accent-deep); font-weight: 500; } .ad-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.02 |
proxy
|
phpinfo
|
Settings