dicr/yii2-google-wdr

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Поиск Google через WebDriver-драйвер для Yii2

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Type:yii2-extension

1.0.3 2021-02-03 20:57 UTC

This package is auto-updated.

Last update: 2021-10-01 00:11:49 UTC


README

Настройка компонента

$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";
}