<?php require 'vendor/autoload.php'; $browser = new \PGuardiario\PGBrowser(); $page = $browser->get('http://www.google.com/search?q=php'); $result = $page->search('li.g a'); for ($i = 0; $i < $result->count(); $i++) { echo $result[$i]->text() . "\n"; }
<?php require 'vendor/autoload.php'; $b = new \PGuardiario\PGBrowser(); $page = $b->get('http://www.google.com/'); $form = $page->form(); $form->set('q', 'foo'); $page = $form->submit(); echo $page->title;
<?php require '../vendor/autoload.php'; $b = new \PGuardiario\PGBrowser(); $page = $b->get('http://data.fingal.ie/ViewDataSets/'); $nextLink = $page->at('//a[@id="lnkNext"][@href]'); $page = $page->form()->doPostBack($nextLink->getAttribute('href')); echo preg_match('/\\b2\\b/', $page->at('//span[@id="lblCurrentPage"]')->nodeValue) ? 'success' : 'failure';