JQuery $ function for PHP

I am wondering if something like JQuery $ ('element.selector') implemented for PHP?

When I am CURL and I received HTML codes from a remote site, I would like to select only the tags that I want before sending to my HTML.

thanks

+4
source share
4 answers

Or maybe Querypath ( http://querypath.org/ )? Just read about it yesterday and it looks cool.

+5
source

PHP Simple HTML DOM Parser has similar functionality:

// Create DOM from URL or file $html = file_get_html('http://www.google.com/'); // Find all images foreach($html->find('img') as $element) echo $element->src . '<br>'; // Find all links foreach($html->find('a') as $element) echo $element->href . '<br>'; 
+14
source
 $ctx = xpath_new_context($doc); $xpath_nodes = xpath_eval($ctx, "//some_element"); 
+1
source

You can use server-side javascript. However, I have not done it yet.

0
source

All Articles