uwebpro / scrapoxy-api
PHP API Container for Scrapoxy Commander
Requires
- php: ^7.3|^8.0
- guzzlehttp/guzzle: ^7.2.0
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