I wrote a little script that extracts information from a web site using PHP's
I query for
<div class="sku" /> and execute a
substring-before on the result. The result contains text, non breaking spaces, a line break and more text.
So what I'm trying to do is cut before the
. It works fine when I use the following query:
$query = "substring-before(//div[@class='sku'],'\xC2\xA0\xC2\xA0 ')";
but fails as soon as I change the quotes (which shouldn't make any difference):
$query = 'substring-before(//div[@class="sku"],"\xC2\xA0\xC2\xA0 ")';
$query = 'substring-before(//div[@class=\'sku\'],\'\xC2\xA0\xC2\xA0 \')';
How is this possible and how can I overcome this?
Live example here: http://codepad.viper-7.com/R1rCaj