File manager - Edit - /home/cipherteam/htdocs/cipherteam.in/API/Finance/index.php
Back
<?php try { include_once("simple_html_dom.php"); $html = file_get_html("https://in.finance.yahoo.com/gainers"); $tbody = $html->find('tbody',0); echo '{ "success": true, "errors": [ "Server Down", "Under Maintance" ], "data": { "list_items": '; $All = []; foreach($tbody->find('tr') as $tr) { //Symbol Name Price Change % Change Volume Avg vol (3-month) Market Cap PE ratio (TTM) $Symbol = $tr->find('td', 0)->plaintext; $Name = $tr->find('td', 1)->plaintext; $Change = $tr->find('td', 2)->plaintext; $ChangePer = $tr->find('td', 3)->plaintext; $Volume = $tr->find('td', 4)->plaintext; $Avg = $tr->find('td', 5)->plaintext; $MarketCap = $tr->find('td', 6)->plaintext; $PE = $tr->find('td', 7)->plaintext; array_push($All, array( $Symbol, $Name, $Change, $ChangePer, $Volume, $Avg, $MarketCap, $PE )); } echo json_encode($All); echo '} }'; } catch (\Throwable $th) { echo '{ "success": false, "errors": [ "Server Down", "Under Maintance" ], "data": { "list_items": [] }, "message": "message according to success" }'; } ?>
| ver. 1.4 |
Github
|
.
| PHP 8.2.9 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings