I have to fetch the value $1999.00 from the following code snippet...
<span class="mainprodpricez" itemprop="price">$1999.00
<span style="font-size:0.4em;display:block;"> including $100 cashback from Shopper</span>
<span style="font-size:0.4em;display:block;font-weight:bold;color:#cc0000;float:left;">You pay $2249.00 today. </span>
Details and claim form.</a></span>
To do this I have done the following coding:
foreach($dom->getElementsByTagName('span') as $p) {
if($p->getAttribute('class') == 'mainprodpricez') {
$name = $p->nodeValue;
}
}
This gives me the following result:
Â$1999.00 including ÂÂ$100 cashback from Shopper You pay Â$2249.00 today. Details and claim form
Actually its fetching the whole nodeValue of the span class mainprodpricez...can anyone please help me on this.