Here is my code:
$url = "https://www.leaseweb.com/dedicated-servers/single-processor";
libxml_use_internal_errors(true);
$doc = new DOMDocument();
$doc->loadHTMLFile($url);
$xpath = new DOMXpath($doc);
$n = $xpath->query('//td[@data-column-name="Model"]');
$r = $xpath->query('//td[@data-column-name="RAM"]');
foreach ($n as $entry) {
$Name = $entry->nodeValue;
$RAM = $r->nodeValue;
echo " $Name - RAM: $RAM<br>";
}
I successfully echo $Name but i can not get the value for $RAM because i do not have it in my array. My question is how i can add $r into this foreach loop and make it work ?
Thanks in advance!
foreach ($n as $key => $entry) { $Name = $entry->nodeValue; $RAM = $r[$key]->nodeValue; echo " $Name - RAM: $RAM<br>"; }$ris related to data of$nthen i can help you.