2017 © Pedro Peláez
 

library pgbrowser

A 'pretty good' mechanize-like php library for managing cookies and submitting forms. [Fork: Totally rewrite]

image

byjg/pgbrowser

A 'pretty good' mechanize-like php library for managing cookies and submitting forms. [Fork: Totally rewrite]

  • Thursday, January 5, 2017
  • by byjg
  • Repository
  • 1 Watchers
  • 1 Stars
  • 12,982 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 12 Forks
  • 0 Open issues
  • 3 Versions
  • 13 % Grown

The README.md

PGBrowser

A 'pretty good' mechanize-like php library for managing cookies and submitting forms. [Fork Version]. This fork version was totally refactored for PSR-0 full compliant and was implemented the persistence of cookies between connection in the same session instance (good for crawling), (*1)

Read the Documentation, (*2)

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;

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

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

require 'vendor\autoload.php';

$browser = new \PGuardiario\PGBrowser(\PGuardario\PGBrowser::PHPQUERY);
$page = $browser->get('http://www.google.com/search?q=php');
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', (*5)

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

The Versions

05/01 2017

1.0.1.x-dev

1.0.1.9999999-dev

A 'pretty good' mechanize-like php library for managing cookies and submitting forms. [Fork: Totally rewrite]

  Sources   Download

The Requires

 

06/05 2016

dev-master

9999999-dev

A 'pretty good' mechanize-like php library for managing cookies and submitting forms. [Fork: Totally rewrite]

  Sources   Download

The Requires

 

06/05 2016

1.0.0

1.0.0.0

A 'pretty good' mechanize-like php library for managing cookies and submitting forms. [Fork: Totally rewrite]

  Sources   Download

The Requires