Recommend this page to a friend! |
Download .zip |
Info | View files (3) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2014-07-29 (2 years ago) | Not enough user ratings | Total: 257 | All time: 7,330 This week: 978 |
Version | License | PHP version | Categories | |||
pgbrowser 0.1 | GNU General Publi... | 3.0 | HTML, HTTP, PHP 5 |
Description | Author | |||||||||||||
This package can access remote site pages submitting forms to emulate a normal Web browser. |
|
PGBrowser ========= A 'pretty good' mechanize-like php library for managing cookies and submitting forms. Read the [Documentation](https://github.com/monkeysuffrage/pgbrowser/wiki) ```php require 'pgbrowser.php'; $b = new 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() PGBrowser will also let you query the page with phpquery, simple-html-dom, [advanced-html-dom](https://sourceforge.net/projects/advancedhtmldom/) or xpath: ```php require 'pgbrowser.php'; require 'phpquery.php'; $browser = new PGBrowser('advanced'); $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' ```php $browser->useCache = true; // turn on cacheing $browser->useCache = false; // turn off cacheing ``` |
Files |
File | Role | Description |
---|---|---|
example.php | Example | Example script |
pgbrowser.php | Class | Class source |
README.md | Doc. | Documentation |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.
Related pages |
Introducing PGBrowser Blog post with sample usage |