Skip to content
Advertisement

Tag: xpath

How to extract price from given url using Xpath?

From a given url I want to extract some detail from it like title, price. For the title, it works fine with this code: But I wonder how to extract price($) using xpath? Is there any way to solve this? Answer This will find <p class=”price right s-cf”>US$160000</p> The contains is doing a wildcard search on the class attribute of

how to get multiple data from xpath query?

This is HTML page (test.html) The PHP Code here NOTE: i want to get result like this Answer One approach is to use the contextnode parameter to DOMXPath::query to do a subquery on each of the mainid elements for the child subids. Something like this: Note that the trim calls are necessary or you will end up with all of

Advertisement