PHP Classes


Recommend this page to a friend!
  Classes of P Guardiario  >  PGBrowser  >  >  Download  
Role: Documentation
Content type: text/plain
Description: Documentation
Class: PGBrowser
Access remote site pages submitting forms
Author: By
Last change: all-in-one version, supports advanced-html-dom
Date: 8 years ago
Size: 1,114 bytes


Class file image Download

A 'pretty good' mechanize-like php library for managing cookies and submitting forms.

Read the [Documentation](

require 'pgbrowser.php';

$b = new PGBrowser();
$page = $b->get('');
$form = $page->form();
$form->set('q', 'foo');
$page = $form->submit();
echo $page->title;

Now do something with $page->html or query it with $page->xpath->query()

PGBrowser will also let you query the page with phpquery, simple-html-dom, [advanced-html-dom]( or xpath:

require 'pgbrowser.php';
require 'phpquery.php';
$browser = new PGBrowser('advanced');
$page = $browser->get('');
foreach($page->search('li.g') as $li){
  echo $li->at('a')->text . "\n";

*New* - PGBrowser can now cache requests to disk and reuse them on subsequent requests to save network traffic. Cached responses go into a folder called 'cache'

$browser->useCache = true; // turn on cacheing
$browser->useCache = false; // turn off cacheing

For more information send a message to info at phpclasses dot org.