Sunday, March 10, 2013

PGBrowser plus phpQuery or Simple Html Dom

Just dropping a quick notice that PGBrowser now lets you query pages with css selectors when used with phpquery or simple-html-dom:

require 'pgbrowser.php';
require 'phpquery.php';

$browser = new PGBrowser('phpquery');
$page = $browser->get('http://www.google.com/search?q=php');
foreach($page->search('li.g') as $li){
  echo $page->at('a', $li)->text() . "\n";
}

No comments:

Post a Comment