Поиск Google через WebDriver для Yii2 ¶
- Настройка компонента
- Использование
Настройка компонента ¶
$config = [
'components' => [
'googleWdr' => [
'class' => dicr\google\wdr\GoogleWdr::class,
'driverUrl' => 'url web-драйвера'
]
]
];
Использование ¶
use dicr\google\wdr\GoogleWdr;
use dicr\google\wdr\GoogleWdrRequest;
$googleWdr = Yii::$app->get('googleWdr');
$req = $googleWdr->searchRequest([
'query' => 'мыльная опера'
]);
foreach ($req->results as $res) {
echo 'URL: ' . $res['url'] . "\n";
echo 'Title: ' . $res['title'] . "\n";
}
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.