My favorites | Sign in
Project Logo
                
Search
for
Updated Oct 23, 2008 by tobiasz.cudnik
Labels: Featured, Phase-Implementation, Plugin
WebBrowser  

WebBrowser is a phpQuery plugin that mimics behaviors of web browser. Thanks to that developer can simulate user's behavior inside a PHP script.

Supported

Use cases

Example 1

Adding web browser functionality to existing phpQuery object and submiting the form.

->WebBrowser('callback')->find('form')->submit()->...

Example 2

Querying Google against "search phrase":

require_once('phpQuery/phpQuery.php');
phpQuery::browserGet('http://google.com/', 'success1');
function success1($browser) {
  $browser
    ->WebBrowser('success2')
    ->find('input[name=q]')
      ->val('search phrase')
      ->parents('form')
        ->submit();
}
function success2($browser) {
  print $browser;
}

Comment by downwiz2, Aug 05, 2009

is it possible to scrape AJAX sites ?

Comment by MarkStoddart, Oct 29, 2009

Yes, but you need to emulate the Javascript yourself.

Comment by Bannistered, Yesterday (16 hours ago)

When trying "Example 2" I receive the error: "Fatal error: Uncaught exception 'Exception' with message 'Request not permitted, host 'www.google.com' not present in phpQuery::$ajaxAllowedHosts'"


Sign in to add a comment
Hosted by Google Code