uwebpro/scrapoxy-api
Composer 安装命令:
composer require uwebpro/scrapoxy-api
包简介
PHP API Container for Scrapoxy Commander
README 文档
README
This package interacts with the API from scrapoxy via a straight-forward interface
Installing
$ composer require uwebpro/scrapoxy-api
Usage
Initialse like so, parameter one is your scrapoxy conf.json file containing
use UWebPro\Scrapoxy\Container;
$api = new Container(__DIR__ . '/conf.json');
If you are using a different scrapoxy host that can be changed like so, by default it is http://127.0.0.1:8889
use UWebPro\Scrapoxy\Container;
$api = new Container(__DIR__ . '/conf.json', 'http://127.0.0.1:8889);
Common functions
To start and stop a proxy pool
if values are left as null they will resume from previously set scaling
$api->start(?int $min, ?int $required, ?int $max);
$api->stop();
To Scale your proxy pool
$api->rescale(int $min, int $required, int $max);
To list proxy instances as objects
$api->getInstances();
Instance object
The following properties are available on the instance object
public string $name;
public string $type;
public string $status;
public array $address;
public string $region;
public bool $alive;
public string $useragent;
As well as the following method
$instance->remove();
An alternative to removing instances is
$api->removeInstance($name);
Scrapoxy config
Scrapoxy's config can be read and updated using the following methods
$api->getConfig(); //returns of config array
$api->updateConfig($configArray);
ALL METHODS RETURN API RESPONSE
Contributing
You can contribute in one of three ways:
- File bug reports using the issue tracker.
- Answer questions or fix bugs on the issue tracker.
- Contribute new features or update the wiki.
You just need to make sure that you follow PSR coding guidelines.
License
MIT
统计信息
- 总下载量: 68
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2020-10-14