Extract Sales rank from a website

473 Views Asked by At

I am trying to extract Sales rank of kindle books from this amazon site.

In the above case the sales rank is 3 (element name "SalesRank")

This is what i have tried till now

$xpath_kindle->query("//li[@id='SalesRank']")->item(0)->nodeValue;

any help is greatly appreciated

1

There are 1 best solutions below

0
On

Use the this xpath: //li[@id='SalesRank']/text() and use regex to select the rank numeral. Also look at this question in SO where some really good tools are mentioned.