php - WHMCS 自定义域注册模块
问题描述
我正在尝试为我的 whmcs 平台创建自定义域注册器模块。在注册商页面中,我的新注册商处于活动状态,getConfigArray 函数可以正常工作,但是当我从订单列表中接受用户注册新域时,whmcs 不会读取我在模块中编写的 registerdomain 函数。模块中的任何打印都不会记录错误或其他任何内容。任何人都可以帮忙吗?
function moduleName_RegisterDomain($params)
{
$fields = array(
'action' => 'domain_create',
'domain' => $params["sld"] . '.' . $params["tld"],
'username' => $params["Username"],
'password' => $params["Password"],
'owner' => $params["firstname"] . ' ' . $params["lastname"],
'period' => $params["regperiod"],
'street' => $params["address1"],
'city' => $params["city"],
'postcode' => str_replace(' ', '', $params["postcode"]),
'country' => $params["countrycode"],
'adminname' => $params["adminfirstname"] . ' ' . $params["adminlastname"],
'adminstreet' => $params["adminaddress1"],
'admincity' => $params["admincity"],
'adminpostcode' => str_replace(' ', '', $params["adminpostcode"]),
'admincountry' => $params["admincountry"],
'adminemail' => $params["adminemail"],
'admintel' => normalisePhone($params["adminphonenumber"]),
'techname' => $params["adminfirstname"] . ' ' . $params["adminlastname"],
'techstreet' => $params["adminaddress1"],
'techcity' => $params["admincity"],
'techpostcode' => str_replace(' ', '', $params["adminpostcode"]),
'techcountry' => $params["admincountry"],
'techemail' => $params["adminemail"],
'techtel' => normalisePhone($params["adminphonenumber"]),
'billname' => $params["adminfirstname"] . ' ' . $params["adminlastname"],
'billstreet' => $params["adminaddress1"],
'billcity' => $params["admincity"],
'billpostcode' => str_replace(' ', '', $params["adminpostcode"]),
'billcountry' => $params["admincountry"],
'billemail' => $params["adminemail"],
'billtel' => normalisePhone($params["adminphonenumber"]),
'ns1name' => $params["ns1"],
'ns2name' => $params["ns2"],
'ns3name' => $params["ns3"],
'ns4name' => $params["ns4"],
);
$request = sendToclouds($fields, $params);
if (!$request['status']) {
$values["error"] = $request['massage'];
} else {
$values["massage"] = true;
}
return $values;
}
function sendToclouds($fields, $params)
{
if ($params['TestMode']) {
$fields['mode'] = 'test';
}
$curl = curl_init(); // we are using cURL library here
curl_setopt($curl, CURLOPT_URL, $params["cloudsURL"]);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $fields);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 90);
$out = curl_exec($curl);
curl_close($curl);
if ($out) {
$str = strtolower($out);
if (strpos($str, 'error') !== false) {
return array('status' => false, 'massage' => $out);
} else {
return array('status' => true, 'massage' => $out);
}
} else {
return array('status' => false, 'massage' => 'Service unavailable');
}
}
解决方案
注册商功能看起来不错。
- 您是否将扩展分配给注册器模块,设置 > 产品和服务 > 自动注册下的域定价。
- 接受订单后,检查域详细信息页面并确保 Registrar 设置为您的模块。
- 如果设置正确,或者手动设置,点击Registrar Commands下的Register,它会尝试执行注册功能。
- 通过放置
error_log('registering domain...', 3, __DIR__.'/file.log');
在函数的第一行,确保调用了您的注册函数。如果它被调用,它会将字符串写入同一目录中的 file.log。
希望能帮助到你。
推荐阅读
- svg - 如何使用这个 UTF-8 SVG 字符串来获取
- python - 使用 docker + django + nginx 时不提供静态文件
- sql - 通过变量从数据集中计算统计数据
- c# - MVVM - 可用于多个视图模型的模型数据
- python - 将单独的熊猫数据框中的列相乘
- postgresql - 将大文件上传到 AWS aurora postgres 无服务器
- regex - preg_replace 最后一个字符
- spring - Spring Boot Scheduler 未在预定时间触发
- azure - 可以向 Azure Data Lake(第 1 代)发送多少请求是否有限制?
- html - React Bootstrap 导航栏主页选项卡总是突出显示