dicr/yii2-google-wdr

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

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Forks: 0

Type:yii2-extension

1.0.3 2021-02-03 20:57 UTC

This package is auto-updated.

Last update: 2024-10-29 06:18:44 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";
}