PHP code example of byjg / pgbrowser
1. Go to this page and download the library: Download byjg/pgbrowser library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
byjg / pgbrowser example snippets
$b = new \PGuardiario\PGBrowser();
$page = $b->get('http://www.google.com/');
$form = $page->form();
$form->set('q', 'foo');
$page = $form->submit();
echo $page->title;
$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";
}
$browser->useCache = true; // turn on cacheing
$browser->useCache = false; // turn off cacheing