為給定服務運行自定義模塊操作。
請求參數
參數 | 類型 | 說明 | 必需的 |
---|---|---|---|
action | string | “ModuleCustom” | Required |
serviceid | int | 為其運行操作的服務 ID | Required |
func_name | string | 要運行的自定義函數的名稱 | Required |
響應參數
參數 | 類型 | 說明 |
---|---|---|
result | string | 操作結果:成功或錯誤 |
示例請求 (CURL)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
http_build_query(
array(
'action' => 'ModuleCustom',
// See https://developers.whmcs.com/api/authentication
'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
'password' => 'SECRET_OR_HASHED_PASSWORD',
'serviceid' => '1',
'func_name' => 'reboot',
'responsetype' => 'json',
)
)
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
示例請求(本地 API)
$command = 'ModuleCustom';
$postData = array(
'serviceid' => '1',
'func_name' => 'reboot',
);
$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later
$results = localAPI($command, $postData, $adminUsername);
print_r($results);
示例響應 JSON
{
"result": "success"
}
錯誤響應
可能的錯誤條件響應包括:
- 服務 ID 為必填項
- 未找到服務 ID
- 服務未分配給模塊
- 服務器響應消息
相關用法
- PHP WHMCS ModuleChangePackage用法及代碼示例
- PHP WHMCS ModuleChangePw用法及代碼示例
- PHP WHMCS ModuleCreate用法及代碼示例
- PHP WHMCS ModuleSuspend用法及代碼示例
- PHP WHMCS ModuleTerminate用法及代碼示例
- PHP WHMCS ModuleUnsuspend用法及代碼示例
- PHP MySQL ROUND()用法及代碼示例
- PHP Memcache::getExtendedStats()用法及代碼示例
- PHP Memcached getByKey()用法及代碼示例
- PHP Memcache::getServerStatus()用法及代碼示例
- PHP Memcache::flush()用法及代碼示例
- PHP Memcache::setCompressThreshold()用法及代碼示例
- PHP Memcached add()用法及代碼示例
- PHP Memcache::pconnect()用法及代碼示例
- PHP Memcache::get()用法及代碼示例
- PHP Memcache::replace()用法及代碼示例
- PHP Memcache::set()用法及代碼示例
- PHP Max()用法及代碼示例
- PHP Memcache::connect()用法及代碼示例
- PHP Memcache::increment()用法及代碼示例
- PHP WHMCS ManualRefund用法及代碼示例
- PHP Memcache::close()用法及代碼示例
- PHP WHMCS MergeTicket用法及代碼示例
- PHP Memcached addServer()用法及代碼示例
- PHP Memcached get()用法及代碼示例
注:本文由純淨天空篩選整理自whmcs.com大神的英文原創作品 ModuleCustom。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。