Correct Way To Load a DomDocument
First, the code:
$dom = new DomDocument();
$dom->load($url);
$root = $dom->documentElement;
Now, you can do anything you want with the $root that represents the document - use getElementsByTagName or get children using $root->childNodes.
If you try using DOMDocument->load() statically, you will get the following error:
Non-static method DOMDocument::load() should not be called statically.
To avoid the error, you need to create an instance of the DomDocument object using the example above.
