激活给定的模块。
请求参数
参数 | 类型 | 说明 | 必需的 |
---|---|---|---|
action | string | “ActivateModule” | Required |
moduleType | string | 要激活的模块类型 | Required |
moduleName | string | 要激活的模块名称 | Required |
parameters | array | 为给定模块设置的配置参数数组。使用GetModuleConfigurationParameters 获取给定模块的字段列表。 |
Optional |
响应参数
参数 | 类型 | 说明 |
---|---|---|
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' => 'ActivateModule',
// See https://developers.whmcs.com/api/authentication
'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
'password' => 'SECRET_OR_HASHED_PASSWORD',
'moduleType' => 'gateway',
'moduleName' => 'paypal',
'parameters' => array('email' => '[email protected]', 'forcesubscriptions' => true),
'responsetype' => 'json',
)
)
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
示例请求(本地 API)
$command = 'ActivateModule';
$postData = array(
'moduleType' => 'gateway',
'moduleName' => 'paypal',
'parameters' => array('email' => '[email protected]', 'forcesubscriptions' => true),
);
$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later
$results = localAPI($command, $postData, $adminUsername);
print_r($results);
示例响应 JSON
{
"result": "success"
}
错误响应
可能的错误条件响应包括:
- 提供的模块类型无效。支持的模块类型包括:xxx
- 提供的模块名称无效。
- 模块类型不支持模块激活。
- 激活失败:xxx
- 发生意外错误:xxx
相关用法
- PHP WHMCS AcceptQuote用法及代码示例
- PHP WHMCS AcceptOrder用法及代码示例
- PHP WHMCS AdminAreaPage用法及代码示例
- PHP ArrayObject setIteratorClass()用法及代码示例
- PHP 匿名递归函数用法及代码示例
- PHP WHMCS AfterRegistrarTransferFailed用法及代码示例
- PHP ArrayIterator asort()用法及代码示例
- PHP WHMCS AddonUnsuspended用法及代码示例
- PHP WHMCS AfterModuleCreate用法及代码示例
- PHP WHMCS AddContact用法及代码示例
- PHP WHMCS AdminAreaViewTicketPage用法及代码示例
- PHP WHMCS AddUser用法及代码示例
- PHP WHMCS AfterShoppingCartCheckout用法及代码示例
- PHP WHMCS AdminClientProfileTabFieldsSave用法及代码示例
- PHP ArrayIterator setFlags()用法及代码示例
- PHP ArrayObject append()用法及代码示例
- PHP AppendIterator rewind()用法及代码示例
- PHP ArrayIterator uasort()用法及代码示例
- PHP ArrayObject ksort()用法及代码示例
- PHP WHMCS AddonAdd用法及代码示例
- PHP ArrayObject unserialize()用法及代码示例
- PHP WHMCS AfterRegistrarRequestDelete用法及代码示例
- PHP WHMCS AddonTerminated用法及代码示例
- PHP WHMCS AfterModuleCustom用法及代码示例
- PHP AppendIterator append()用法及代码示例
注:本文由纯净天空筛选整理自whmcs.com大神的英文原创作品 ActivateModule。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。