I have a multiple php xpath codes that takes around 5 to 10 seconds to load.
Here is the code if that will make any difference:
<?php
$html_string = file_get_contents('https://website.com/');
$dom = new DOMDocument();
libxml_use_internal_errors(true);
$dom->loadHTML($html_string);
libxml_clear_errors();
$xpath = new DOMXpath($dom);
$values = array();
$row = $xpath->query('//*[@id="wsod_forecasts"]/div[2]/p/strong');
foreach($row as $value) {
print($value->nodeValue);
}
?>
My question is, is it possible to create a simple loading image or a text, while the code is loading?
Like this:
<image loading script>
<?php ?>
</image loading script end>
Any ideas? thanks.