I am trying to extract image from this given website https://www.wikidata.org/wiki/Q1359568 More specifically i want to parse this
Here is the library that i use
composer require "ivopetkov/html5-dom-document-php:2.*"
here is my code
$dom = new HTML5DOMDocument(); $html=file_get_contents('https://www.wikidata.org/wiki/Q1359568'); $dom->loadHTML($html); echo $dom->querySelector('img')->querySelector('src')->outerHTML;
but i got this exception
Trying to get property 'outerHTML' of non-object
My final goal is to get the image link from srcet tag
1.4m articles
1.4m replys
5 comments
57.0k users