Page 1 of 1

select elements from a webpage

Posted: Wed May 09, 2012 10:14 pm
by wvoyance
I use
$find = file_get_contents('http://find.nlbook/');
to get the content of a webpage.
Is there a method like jQuery selector that
I can select a specific part from the HTML?

I want a <div > with ID='profile'

Re: select elements from a webpage

Posted: Wed May 09, 2012 11:26 pm
by requinix
Not really. But the DOM extension gives you some of the same functionality that JavaScript can offer; getElementById and getElementsByTagName for instance.

Re: select elements from a webpage

Posted: Thu May 10, 2012 1:54 pm
by tr0gd0rr
I've been using QueryPath for over a year now and have found it to be very reliable. They advertise it as having an API very similar to jQuery. As a bonus, it can also update the HTML.