I had the following code which works fine on my localhost:
$document = new DOMDocument();
$document->loadHTML($p_result);
$form = $document->getElementsByTagName('form')->item(0);
// Code continues using the $form variable
After same code get updated on outside server, loadHTML()
failed and issued this warning.
Warning: DOMDocument::loadHTML() expects parameter 1 to be a valid path, string given in path/name/to/script.php
Returned NULL as well instead of object so code pretty soon gets to the fatal error.
Note that the contents of $p_result
is absolutely the same on outside server and on my localhost.
But why does it displays that kind of warning and why does it not work?
Doesn't it loadHTML()
expects argument 1 to be a string in the first place?
Why does it say that this method expects parameter 1 to be a valid path
?
Just to make it clear I'm not calling loadHTMLFile()
, I'm calling loadHTML()
.
Thanks.