aminireza-ir / cpanel
working wtih Cpanel API easily
v1.1.0
2020-03-05 13:57 UTC
This package is auto-updated.
Last update: 2024-10-29 05:53:23 UTC
README
A simple library for using from Cpanel-API easily You can use this library to work easily with Cpanel-API.
Install Guide :
composer require aminireza-ir/cpanel
How to Connect to Cpanel :
<?php require_once __DIR__.'/vendor/autoload.php'; use Src\Methods; $cpanel = new Methods([ 'host' => '127.0.0.1', 'api_key' => 'LKACN0OGIWFVOO5FNYNVZX2NOYOP7GWO', 'username' => 'root', 'port' => 2087, ]); echo $cpanel->SendWithArray('Bandwidth', 'getbwdata', 'username');
- If you want to use password you should follow this code :
<?php $cpanel = new Methods([ 'host' => '127.0.0.1', 'password' => '!password1234', 'username' => 'root', 'port' => 2087, ]);
Examples
You can see a simple example to add a new cron job in cpanel :
<?php $cpanel->SendWithArray('Cron', 'add_line', 'user', [ 'command' => '/usr/bin/perl%20/home/username/happynewyear.pl', 'day' => 1, 'hour' => 0, 'minute' => 0, 'month' => 1, 'weekday' => '*' ]);