I noticed that on this url: http://www.bubbleroom.se/sv/kläder/kvinna/controlbody/bodys/body-nero there is a null character \u0 in the tag with id prodText.

The whole document seems to end by this null char when attempting to extract anything else after this character.


Edit

The code that "doesn't" work. It works, but not when there's a null char in the $html string

$dom = new DOMDocument;
libxml_use_internal_errors(true);
$dom->loadHTML($html);
libxml_clear_errors();

return new DOMXPath($dom);
有帮助吗?

解决方案

I solved the issue by simply filtering the html before creating an xpath instance with the following code:

$html  = str_replace("\0", "", $html);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top