- <?php
- header('Content-Type: application/json');
- include('simple_html_dom.php');
- $btc = 0;
- $eth = 0;
- $dash = 0;
- $pivx = 0;
- $opts = array('http'=>array('header' => "User-Agent:MyAgent/1.0\r\n"));
- $context = stream_context_create($opts);
- // BTC
- $html = file_get_html('https://www.coingecko.com/en/coins/bitcoin',false,$context);
- foreach($html->find("span") as $span){
- if($span->{'data-coin-symbol'} != false){
- $btc = $span->innertext;
- break;
- }
- }
- // ETH
- $html = file_get_html('https://www.coingecko.com/en/coins/ethereum',false,$context);
- foreach($html->find("span") as $span){
- if($span->{'data-coin-symbol'} != false){
- $eth = $span->innertext;
- break;
- }
- }
- // DASH
- $html = file_get_html('https://www.coingecko.com/en/coins/dash',false,$context);
- foreach($html->find("span") as $span){
- if($span->{'data-coin-symbol'} != false){
- $dash = $span->innertext;
- break;
- }
- }
- // PIVX
- $html = file_get_html('https://www.coingecko.com/en/coins/pivx',false,$context);
- foreach($html->find("span") as $span){
- if($span->{'data-coin-symbol'} != false){
- $pivx = $span->plaintext;
- break;
- }
- }
- // Aktie
- $html = file_get_html('https://www.finanzen.net/aktien/Tesla-Aktie',false,$context);
- foreach($html->find("div[class=quotebox]") as $qbox){
- foreach($qbox->find("div") as $div){
- $tesla = trim($div->plaintext);
- break;
- }
- break;
- }
- echo "Tesla: ".str_replace('EUR','',$tesla)."€ BTC:$btc ETH:$eth DASH:$dash PIVX:$pivx";
- ?>