Last active
June 12, 2016 15:42
-
-
Save kjellberg/cdf111ae55119109f29a74bb061c7afe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$keyword = "test kit"; | |
$dbc = new DBCSolver("user", "pass"); | |
$google = new GoogleSearch(); | |
$proxy = Proxy::getProxy(); | |
// all available preferences for Google | |
$google->setPreference('results_per_page', 100); | |
$google->setPreference('google_domain', 'google.se'); | |
$google->setProxy($proxy->toString()); | |
//$google->setPreference('date_range', 'hour'); | |
$results = array(); | |
$response = $google->search($keyword, 1); | |
if($response->error == 'captcha'){ | |
$status = $google->solveCaptcha($dbc); | |
// try keyword again after solving captcha | |
$response = $google->search($keyword, 1); | |
} | |
$results[] = $response->results; | |
return $results[0]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment