dicr / yii2-google-wdr
Поиск Google через WebDriver-драйвер для Yii2
1.0.3
2021-02-03 20:57 UTC
Requires
- php: ~7.4 || ~8.0.1
- dicr/yii2-anticaptcha: ~1.0
- dicr/yii2-validate: ~2.3
- php-webdriver/webdriver: ~1.8
- simplehtmldom/simplehtmldom: ~2.0-RC2
- yiisoft/yii2: ~2.0
Requires (Dev)
- phpunit/phpunit: ~9.5
- roave/security-advisories: dev-master
This package is auto-updated.
Last update: 2024-10-29 06:18:44 UTC
README
- php-webdriver: https://github.com/php-webdriver/php-webdriver
- ChromeDriver: https://sites.google.com/a/chromium.org/chromedriver/downloads
- GeckoDriver: https://github.com/mozilla/geckodriver/releases
Настройка компонента
$config = [
'components' => [
'googleWdr' => [
'class' => dicr\google\wdr\GoogleWdr::class,
'driverUrl' => 'url web-драйвера'
]
]
];
Использование
use dicr\google\wdr\GoogleWdr;
use dicr\google\wdr\GoogleWdrRequest;
/** @var GoogleWdr $googleWdr модуль */
$googleWdr = Yii::$app->get('googleWdr');
/** @var GoogleWdrRequest $req запрос создания задачи */
$req = $googleWdr->searchRequest([
'query' => 'мыльная опера'
]);
// выводим результаты
foreach ($req->results as $res) {
echo 'URL: ' . $res['url'] . "\n";
echo 'Title: ' . $res['title'] . "\n";
}