aminireza-ir / cpanel
轻松使用 Cpanel API
v1.1.0
2020-03-05 13:57 UTC
This package is auto-updated.
Last update: 2024-08-29 05:24:45 UTC
README
这是一个简单的库,方便您轻松使用 Cpanel-API。您可以使用这个库轻松地与 Cpanel-API 进行交互。
安装指南
composer require aminireza-ir/cpanel
如何连接到 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');
- 如果您想使用密码,应遵循以下代码
<?php $cpanel = new Methods([ 'host' => '127.0.0.1', 'password' => '!password1234', 'username' => 'root', 'port' => 2087, ]);
示例
您可以看到一个简单示例,用于在 cpanel 中添加新的 cron 任务
<?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' => '*' ]);