I am trying to parse all script src link values, but I get an empty array.
$dom = new DOMDocument();
$file = @$dom->loadHTML($remote);
$xpath = new DOMXpath($dom);
$link = $xpath->query('//script[contains(@src, "pcode")]');
$return = array();
foreach($link as $links) {
$return[] = $links->nodeValue;
}
scripthave@srcthey shouldn't have content, you are using the wrong DOM method. SeetextContentfrom DOM level 3.srcattribute, then you should be selecting them with//script/@src[contains(.,"pcode")].