i am using the following code to scrape some data from amazon
$nodelist = $xpath_cat->query('//li[@id="SalesRank"]/text()');
foreach ($nodelist as $node) {
$nodearr[] = trim($node->textContent);
}
var_dump($nodearr);
and dumping the result, the output is
array
0 => string '' (length=0)
1 => string '#14,000 Paid in Kindle Store (' (length=30)
2 => string ')' (length=1)
3 => string '' (length=0)
4 => string '#21,322 Paid in Kindle Store (' (length=30)
5 => string ')' (length=1)
6 => string '' (length=0)
7 => string '#20,957 Paid in Kindle Store (' (length=30)
8 => string ')' (length=1)
what is want is on # part which is element 2 in array like
#"#20,957 Paid in Kindle Store"
how can modify the code to get my output? i was thinking it to use unset() but i am confused in implementing it. also, there is "(" which also needs to be deleted from the string
Guide me please..how can i modify my code?