File manager - Edit - /home/cipherteam/htdocs/cipherteam.in/API/STOCK_NEWS/V2NEW/onlyseller.php
Back
<?php include_once("Market.php"); if(isMarketOpen()) { include_once("simple_html_dom.php"); include_once("Connection.php"); try { $html = file_get_html("https://www.financialexpress.com/market/stock-market/nse-sellers/"); $tbody = $html->find('tbody',1); if(!$tbody) { throw new Exception('Exception message'); } $gainers["SELLERS"] = array(); $tmp = $tbody->find('tr',0); if(!$tmp) { throw new Exception('Exception message'); } $first = true; foreach($tbody->find('tr') as $tr) { if($first) { $sql = "DELETE FROM `only_sellers`"; $con->query($sql); $first = false; } $cname = $tr->find('td', 0)->plaintext; $qty = $tr->find('td', 1)->plaintext; $price = $tr->find('td', 2)->plaintext; $preprice = $tr->find('td', 3)->plaintext; $chng = $tr->find('td', 4)->plaintext; $chngper = $tr->find('td', 5)->plaintext.'%'; $volume = $tr->find('td', 6)->plaintext; $gainer = array( 'NAME'=>$cname, 'QTY'=>$qty, 'PRICE'=>$price, 'PREPRICE'=>$preprice, 'CHANGE'=>$chng, 'CHANGEPER'=>$chngper, 'VOLUME'=>$volume ); $sql = "INSERT INTO `only_sellers` (`cname`, `bidqty`, `price`, `preprice`, `chng`, `chngper`, `volume`) VALUES ('$cname', '$qty', '$price', '$preprice', '$chng', '$chngper', '$volume');"; $con->query($sql); array_push($gainers["SELLERS"],$gainer); } $gainers["success"] = 1; echo json_encode($gainers); } catch(Exception $e) { $sql = "SELECT `cname` AS 'NAME',`bidqty` AS 'QTY',`price` AS 'PRICE',`preprice` AS 'PREPRICE',`chng` AS 'CHANGE',`chngper` AS 'CHANGEPER',`volume` AS 'VOLUME' FROM `only_sellers`;"; $rows = $con->query($sql); $gainers["SELLERS"] = array(); if($rows->num_rows > 0) { while($row = $rows->fetch_assoc()) { $div = array(); $div = $row; array_push($gainers["SELLERS"],$div); } $gainers["success"] = 1; echo json_encode($gainers); } } } else { include_once("Connection.php"); $sql = "SELECT `cname` AS 'NAME',`bidqty` AS 'QTY',`price` AS 'PRICE',`preprice` AS 'PREPRICE',`chng` AS 'CHANGE',`chngper` AS 'CHANGEPER',`volume` AS 'VOLUME' FROM `only_sellers`;"; $rows = $con->query($sql); $gainers["SELLERS"] = array(); if($rows->num_rows > 0) { while($row = $rows->fetch_assoc()) { $div = array(); $div = $row; array_push($gainers["SELLERS"],$div); } $gainers["success"] = 1; echo json_encode($gainers); } } ?>
| ver. 1.4 |
Github
|
.
| PHP 8.2.9 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings