Let's say I want to extract the current bitcoin exchange rate (in EUR) from the German exchange bitcoin.de and the value shall be fetched each time I visit my site (so no caching). I was able to extract the value in PHP:
// fetch contents from bitcoin.de
$url = 'https://www.bitcoin.de/de/';
$content = file_get_contents($url);
// cut everything before specified text
$content = strstr($content, "Aktueller Bitcoin Kurs");
// extract rate
$rate = strstr($content, "<b>");
$rate = substr($rate, 3);
$rate = strstr($rate, "€", true);
echo $rate . " EUR"; // e.g. 105,51 EUR
This works fine and prints the correct current value as it can be found on the bitcoin.de website. But I am fetching the whole website content, substract everything I don't need, and return it.
My question: Is there a way (maybe also using jQuery) to solve this more efficiently; ergo not fetching the whole site code but only the rate value?