Jump to content

Problem With WHMCS Domain Registrar Module


hostsleek

Recommended Posts

Hello how do i fix this issue

How do i add my code here?

How do i access my registrar API

How do i talk to the API of my registrar? what code do i need to write.

 

Pls take a look @ this and tell me what to fix

 

<?php

 

function ng_getConfigArray() {

$configarray = array(

"Username" => array( "Type" => "text", "Size" => "20", "Description" => "Enter your username here", ),

"Password" => array( "Type" => "password", "Size" => "20", "Description" => "Enter your password here", ),

"TestMode" => array( "Type" => "yesno", ),

);

return $configarray;

}

 

function ng_GetNameservers($params) {

$username = $params["Username"];

$password = $params["Password"];

$testmode = $params["TestMode"];

$tld = $params["tld"];

$sld = $params["sld"];

# Put your code to get the nameservers here and return the values below

$values["ns1"] = $nameserver1;

$values["ns2"] = $nameserver2;

$values["ns3"] = $nameserver3;

$values["ns4"] = $nameserver4;

# If error, return the error message in the value below

$values["error"] = $error;

return $values;

}

 

function ng_SaveNameservers($params) {

$username = $params["Username"];

$password = $params["Password"];

$testmode = $params["TestMode"];

$tld = $params["tld"];

$sld = $params["sld"];

$nameserver1 = $params["ns1"];

$nameserver2 = $params["ns2"];

$nameserver3 = $params["ns3"];

$nameserver4 = $params["ns4"];

# Put your code to save the nameservers here

# If error, return the error message in the value below

$values["error"] = $error;

return $values;

}

 

function ng_GetRegistrarLock($params) {

$username = $params["Username"];

$password = $params["Password"];

$testmode = $params["TestMode"];

$tld = $params["tld"];

$sld = $params["sld"];

# Put your code to get the lock status here

if ($lock=="1") {

$lockstatus="locked";

} else {

$lockstatus="unlocked";

}

return $lockstatus;

}

 

function ng_SaveRegistrarLock($params) {

$username = $params["Username"];

$password = $params["Password"];

$testmode = $params["TestMode"];

$tld = $params["tld"];

$sld = $params["sld"];

if ($params["lockenabled"]) {

$lockstatus="locked";

} else {

$lockstatus="unlocked";

}

# Put your code to save the registrar lock here

# If error, return the error message in the value below

$values["error"] = $Enom->Values["Err1"];

return $values;

}

 

function ng_GetEmailForwarding($params) {

$username = $params["Username"];

$password = $params["Password"];

$testmode = $params["TestMode"];

$tld = $params["tld"];

$sld = $params["sld"];

# Put your code to get email forwarding here - the result should be an array of prefixes and forward to emails (max 10)

foreach ($result AS $value) {

$values[$counter]["prefix"] = $value["prefix"];

$values[$counter]["forwardto"] = $value["forwardto"];

}

return $values;

}

 

function ng_SaveEmailForwarding($params) {

$username = $params["Username"];

$password = $params["Password"];

$testmode = $params["TestMode"];

$tld = $params["tld"];

$sld = $params["sld"];

foreach ($params["prefix"] AS $key=>$value) {

$forwardarray[$key]["prefix"] = $params["prefix"][$key];

$forwardarray[$key]["forwardto"] = $params["forwardto"][$key]

}

# Put your code to save email forwarders here

}

 

function ng_GetDNS($params) {

$username = $params["Username"];

$password = $params["Password"];

$testmode = $params["TestMode"];

$tld = $params["tld"];

$sld = $params["sld"];

# Put your code here to get the current DNS settings - the result should be an array of hostname, record type, and address

$hostrecords = array();

$hostrecords[] = array( "hostname" => "ns1", "type" => "A", "address" => "192.168.0.1", );

$hostrecords[] = array( "hostname" => "ns2", "type" => "A", "address" => "192.168.0.2", );

return $hostrecords;

 

}

 

function ng_SaveDNS($params) {

$username = $params["Username"];

$password = $params["Password"];

$testmode = $params["TestMode"];

$tld = $params["tld"];

$sld = $params["sld"];

# Loop through the submitted records

foreach ($params["dnsrecords"] AS $key=>$values) {

$hostname = $values["hostname"];

$type = $values["type"];

$address = $values["address"];

# Add your code to update the record here

}

# If error, return the error message in the value below

$values["error"] = $Enom->Values["Err1"];

return $values;

}

 

function ng_RegisterDomain($params) {

$username = $params["Username"];

$password = $params["Password"];

$testmode = $params["TestMode"];

$tld = $params["tld"];

$sld = $params["sld"];

$regperiod = $params["regperiod"];

$nameserver1 = $params["ns1"];

$nameserver2 = $params["ns2"];

$nameserver3 = $params["ns3"];

$nameserver4 = $params["ns4"];

# Registrant Details

$RegistrantFirstName = $params["firstname"];

$RegistrantLastName = $params["lastname"];

$RegistrantAddress1 = $params["address1"];

$RegistrantAddress2 = $params["address2"];

$RegistrantCity = $params["city"];

$RegistrantStateProvince = $params["state"];

$RegistrantPostalCode = $params["postcode"];

$RegistrantCountry = $params["country"];

$RegistrantEmailAddress = $params["email"];

$RegistrantPhone = $params["phonenumber"];

# Admin Details

$AdminFirstName = $params["adminfirstname"];

$AdminLastName = $params["adminlastname"];

$AdminAddress1 = $params["adminaddress1"];

$AdminAddress2 = $params["adminaddress2"];

$AdminCity = $params["admincity"];

$AdminStateProvince = $params["adminstate"];

$AdminPostalCode = $params["adminpostcode"];

$AdminCountry = $params["admincountry"];

$AdminEmailAddress = $params["adminemail"];

$AdminPhone = $params["adminphonenumber"];

# Put your code to register domain here

# If error, return the error message in the value below

$values["error"] = $error;

return $values;

}

 

function ng_TransferDomain($params) {

$username = $params["Username"];

$password = $params["Password"];

$testmode = $params["TestMode"];

$tld = $params["tld"];

$sld = $params["sld"];

$regperiod = $params["regperiod"];

$transfersecret = $params["transfersecret"];

$nameserver1 = $params["ns1"];

$nameserver2 = $params["ns2"];

# Registrant Details

$RegistrantFirstName = $params["firstname"];

$RegistrantLastName = $params["lastname"];

$RegistrantAddress1 = $params["address1"];

$RegistrantAddress2 = $params["address2"];

$RegistrantCity = $params["city"];

$RegistrantStateProvince = $params["state"];

$RegistrantPostalCode = $params["postcode"];

$RegistrantCountry = $params["country"];

$RegistrantEmailAddress = $params["email"];

$RegistrantPhone = $params["phonenumber"];

# Admin Details

$AdminFirstName = $params["adminfirstname"];

$AdminLastName = $params["adminlastname"];

$AdminAddress1 = $params["adminaddress1"];

$AdminAddress2 = $params["adminaddress2"];

$AdminCity = $params["admincity"];

$AdminStateProvince = $params["adminstate"];

$AdminPostalCode = $params["adminpostcode"];

$AdminCountry = $params["admincountry"];

$AdminEmailAddress = $params["adminemail"];

$AdminPhone = $params["adminphonenumber"];

# Put your code to transfer domain here

# If error, return the error message in the value below

$values["error"] = $error;

return $values;

}

 

function ng_RenewDomain($params) {

$username = $params["Username"];

$password = $params["Password"];

$testmode = $params["TestMode"];

$tld = $params["tld"];

$sld = $params["sld"];

$regperiod = $params["regperiod"];

# Put your code to renew domain here

# If error, return the error message in the value below

$values["error"] = $error;

return $values;

}

 

function ng_GetContactDetails($params) {

$username = $params["Username"];

$password = $params["Password"];

$testmode = $params["TestMode"];

$tld = $params["tld"];

$sld = $params["sld"];

# Put your code to get WHOIS data here

# Data should be returned in an array as follows

$values["Registrant"]["First Name"] = $firstname;

$values["Registrant"]["Last Name"] = $lastname;

$values["Admin"]["First Name"] = $adminfirstname;

$values["Admin"]["Last Name"] = $adminlastname;

$values["Tech"]["First Name"] = $techfirstname;

$values["Tech"]["Last Name"] = $techlastname;

return $values;

}

 

function ng_SaveContactDetails($params) {

$username = $params["Username"];

$password = $params["Password"];

$testmode = $params["TestMode"];

$tld = $params["tld"];

$sld = $params["sld"];

# Data is returned as specified in the GetContactDetails() function

$firstname = $params["contactdetails"]["Registrant"]["First Name"];

$lastname = $params["contactdetails"]["Registrant"]["Last Name"];

$adminfirstname = $params["contactdetails"]["Admin"]["First Name"];

$adminlastname = $params["contactdetails"]["Admin"]["Last Name"];

$techfirstname = $params["contactdetails"]["Tech"]["First Name"];

$techlastname = $params["contactdetails"]["Tech"]["Last Name"];

# Put your code to save new WHOIS data here

# If error, return the error message in the value below

$values["error"] = $error;

return $values;

}

 

function ng_GetEPPCode($params) {

$username = $params["Username"];

$password = $params["Password"];

$testmode = $params["TestMode"];

$tld = $params["tld"];

$sld = $params["sld"];

# Put your code to request the EPP code here - if the API returns it, pass back as below - otherwise return no value and it will assume code is emailed

$values["eppcode"] = $eppcode;

# If error, return the error message in the value below

$values["error"] = $error;

return $values;

}

 

function ng_RegisterNameserver($params) {

$username = $params["Username"];

$password = $params["Password"];

$testmode = $params["TestMode"];

$tld = $params["tld"];

$sld = $params["sld"];

$nameserver = $params["nameserver"];

$ipaddress = $params["ipaddress"];

# Put your code to register the nameserver here

# If error, return the error message in the value below

$values["error"] = $error;

return $values;

}

 

function ng_ModifyNameserver($params) {

$username = $params["Username"];

$password = $params["Password"];

$testmode = $params["TestMode"];

$tld = $params["tld"];

$sld = $params["sld"];

$nameserver = $params["nameserver"];

$currentipaddress = $params["currentipaddress"];

$newipaddress = $params["newipaddress"];

# Put your code to update the nameserver here

# If error, return the error message in the value below

$values["error"] = $error;

return $values;

}

 

function ng_DeleteNameserver($params) {

$username = $params["Username"];

$password = $params["Password"];

$testmode = $params["TestMode"];

$tld = $params["tld"];

$sld = $params["sld"];

$nameserver = $params["nameserver"];

# Put your code to delete the nameserver here

# If error, return the error message in the value below

$values["error"] = $error;

return $values;

}

 

?>

Link to comment
Share on other sites

to be honest, you're probably in a bit over your head based on the questions you've asked. Most of them are going to be extremely specific depending on the registrar you're using.

 

The code you've pasted is just the sample module provided by WHMCS. It does not do anything other than show you how to access variables and what should be returned. It makes no attempts to connect to your registrar.

Link to comment
Share on other sites

This are the step

 

1. Take the registrar module template and rename to modulename.php

2. Replace all occurrences of template_ with modulename_ inside the file

3. Add your code into the function calls

4. Delete any function calls that your module doesn’t support

5. Save any changes

6. Upload to the path modules/registrars/modulename/modulename.php

7. Activate and configure your module in Config > Domain Registrars

 

How do i do step 3

 

I have the API key

and API id

Link to comment
Share on other sites

Sorry, I'm not trying to insult your intelligence, but if you're asking these kind of questions I do not think you have the programming skills necessary to complete this.

 

The solution is fairly straight forward, and as I said before, the code you enter in the functions depends heavily on what registrar you're using and how their API works.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated