loadHTML($string); $finder = new DomXPath($dom); $content = $finder->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' stretched-link ')]"); foreach($content as $node) { $tmp = $node->attributes[0]->value; if (str_contains($tmp, '?')) { $tmp = substr($tmp, 0, strpos($tmp, "?")); } print_r($tmp); echo "
"; } ?>