|
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 1Adding web browser functionality to existing phpQuery object and submiting the form. ->WebBrowser('callback')->find('form')->submit()->...Example 2Querying 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;
}
|
Sign in to add a comment
is it possible to scrape AJAX sites ?
Yes, but you need to emulate the Javascript yourself.
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'"