macklus / yii2-crawler
Advanced web crawler
Installs: 67
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 3
Forks: 0
Open Issues: 1
Type:yii2-extension
Requires
- fabpot/goutte: ^3.1
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-11-09 20:12:18 UTC
README
Advanced web crawler module
Features
- Multiple connections on single object
- Define and use multiple proxys
- Define and use multiple identities (usarname/password)
Install
Install using composer:
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist macklus/yii2-geoselect "*"
or add
"macklus/yii2-geoselect": "*"
to the require section of your composer.json
file.
Usage
Create new object:
<?php namespace app\controllers; use macklus\Crawler\Crawler; class TestController extends Controller { public function actionCraw() { $crawler = new Crawler(); } }
UserAgent
$crawler->setUA($browser) /* * Browser could be chrome, firefox or explorer */
Identities
$crawler->setUser($name, $user, $password) $crawler->setUsers(['user1' => ['username' => 'jhon', 'password' => 'doe']])
Proxys
$crawler->setProxy($name, $string) $crawler->setProxys([['proxy1' => 'proxystring', 'proxy2' => 'proxy2string]]) /* * string should contain all proxy info, like http://username:password@proxy.thing.com:8080/ */