File manager - Edit - /home/cipherteam/htdocs/cipherteam.in/API/ew/VolumeBuzzers.php
Back
<?php // DataGetter/VolumeBuzzers.php /* -------------------- CORS -------------------- Called via cross-origin browser AJAX from sharemarketipo.in (and possibly other properties). Must be set before ANY other output. ------------------------------------------------ */ $allowedOrigins = [ 'https://sharemarketipo.in', 'https://applyipo.in', ]; $origin = $_SERVER['HTTP_ORIGIN'] ?? ''; if (in_array($origin, $allowedOrigins, true)) { header('Access-Control-Allow-Origin: ' . $origin); header('Access-Control-Allow-Methods: GET'); header('Access-Control-Allow-Headers: Content-Type'); } $grd = 2; if (isset($_GET['exc'])) $exc = $_GET['exc']; else $exc = "NSE"; if (isset($_GET['idx'])) $idx = $_GET['idx']; else $idx = "-44"; if (isset($_GET['ped'])) $ped = $_GET['ped']; else $ped = "FTD"; /* -------------------- Robust fetch: real timeouts + one retry -------------------- NOTE: headers below reference ewmw.edelweiss.in / www.edelweiss.in while the request URL targets nwmw.nuvamawealth.com — that mismatch was already present in the original file. Left unchanged since the correct values aren't known; worth double-checking with whoever supplied this endpoint. ------------------------------------------------------------------------------- */ $response = false; $httpCode = null; for ($attempt = 1; $attempt <= 2; $attempt++) { $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://nwmw.nuvamawealth.com/api/Market/volumebuzzers', 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 => 'POST', CURLOPT_POSTFIELDS =>'{"exc":"' . $exc . '","idx":"' . $idx . '","ped":"' . $ped . '"}', CURLOPT_HTTPHEADER => array( 'authority: ewmw.edelweiss.in', 'accept: application/json, text/plain, */*', 'accept-language: en-US,en;q=0.9,gu;q=0.8,zh-TW;q=0.7,zh;q=0.6', 'content-type: application/json;charset=UTF-8', 'origin: https://www.edelweiss.in', 'referer: https://www.edelweiss.in/', 'sec-ch-ua: ".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"', 'sec-ch-ua-mobile: ?1', 'sec-ch-ua-platform: "Android"', 'sec-fetch-dest: empty', 'sec-fetch-mode: cors', 'sec-fetch-site: same-site', 'user-agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Mobile Safari/537.36' ), )); $response = curl_exec($curl); $errno = curl_errno($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; } $data = ($httpCode === 200 && !empty($response)) ? json_decode($response, true) : null; $rows = is_array($data) ? ($data['data']['vBuzz'] ?? []) : []; if (empty($rows)): ?> <div class="empty"> <div class="empty__icon">i</div> <div class="empty__text">No Data Found</div> <div class="empty__sub">Could not reach data source. Please try again.</div> </div> <?php else: foreach ($rows as $list): $name = $list['dpName'] ?? ''; $ltp = $list['ltp'] ?? ''; $chngPer = $list['chgP'] ?? 0; $xtime = $list['xTime'] ?? ''; ?> <div class="stock-row"> <div class="stock-row__name"><?php echo $name; ?></div> <div class="stock-row__num stock-row__num--accent"><?php echo $ltp; ?></div> <div class="stock-row__num <?php if($chngPer > 0) echo 'stock-row__num--pos'; elseif($chngPer < 0) echo 'stock-row__num--neg'; else echo 'stock-row__num--neu'; ?>"><?php if($chngPer > 0) { echo '+' . $chngPer . '%'; } elseif($chngPer < 0) { echo $chngPer . '%'; } else { echo $chngPer . '%'; } ?></div> <div class="stock-row__num"><?php echo $xtime; ?></div> </div> <?php endforeach; endif; ?> <style> .empty { padding: 30px 20px; text-align: center; } .empty__icon { width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 50%; background: var(--accent, #F16334); color: #fff; display: flex; align-items: 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, #333); font-weight: 500; } .empty__sub { margin-top: 4px; font-size: 12px; color: var(--accent-dark, #666); opacity: 0.75; } </style>
| ver. 1.4 |
Github
|
.
| PHP 8.2.9 | Generation time: 0.08 |
proxy
|
phpinfo
|
Settings