我正在尝试为我的whmcs平台创建自定义域名注册商模块。在注册商页面中,我的新注册商处于活动状态,getConfigArray功能正常工作,但是当我从我的订单列表中接受用户注册新域时,whmcs不会读取我的模块中写入的注册域功能。模块中没有任何内容可以记录错误或其他任何内容。有人可以帮忙吗?
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');
}
}
注册商功能看起来很好。
error_log('registering domain...', 3, __DIR__.'/file.log');
放在函数的第一行,确保调用您的注册函数。如果它被调用,它会将字符串写入同一目录中的file.log。希望能帮助到你。