I'm using DOMDocument with xpath to load some data to my site from external (fast) website.
Right now I use 4 urls (please see below). I need to increase to 8 urls.
What I have noticed, that the more of those you add, the more slower the site loads.
Is there any way to use xpath for more faster load?
Or maybe there's at least some kind of a way to load the data on website1 (child website) and when it loads, include the data to my main website.
Any tips would be appeciated.
<?php
$parent_title = get_the_title( $post->post_parent );
$html_string = file_get_contents('weburladresshere');
$dom = new DOMDocument();
libxml_use_internal_errors(true);
$dom->loadHTML($html_string);
libxml_clear_errors();
$xpath = new DOMXpath($dom);
$values = array();
$row = $xpath->query('myquery');
foreach($row as $value) {
print($value->nodeValue);
}
?>