i need to find the image link and a href . show href,img src, and alt tag.
here my code
$xpath = new DOMXPath('http,://.....');
foreach ($xpath->query('//a[@href]//img') as $img) {
echo '<a href=' .'"' .$img['href'] .'"' .'/>' .'<img src="' .$img['src'] .'"' .'alt="' .$img['alt'] .'"/>' .'</a>';
Catchable fatal error: Argument 1 passed to DOMXPath::__construct() must be an
instance of DOMDocument, string given, called in
Can you help me??