Jump to content

goldenmaza

Member
  • Posts

    3
  • Joined

  • Last visited

About goldenmaza

goldenmaza's Achievements

Junior Member

Junior Member (1/3)

0

Reputation

  1. Another question: If I have an order with multiple domain registrations, how do I setup the postfields for the curl call? Meaning the following example under the WHMCS documentations: $postfields["nameserver1"] = "ns1.demo.com"; $postfields["nameserver2"] = "ns2.demo.com"; $postfields["nameserver3"] = "ns3.demo.com"; $postfields["nameserver4"] = "ns4.demo.com"; According to the example, this is how you are suppose to go by, if there are multiple products under the order. How does the WHMCS server know the difference? There is nothing on those four lines that tells the WHMCS system that they belong to the domain item 0 (domain[0]) or the item 1 (domain[1]). If we follow the example stated, shouldnt the system require the nameservers to be stated like: nameserver[0][0], nameserver[0][1] and for the second domain: nameserver[1][0], nameserver[1][1]? If I have like 3 domains to register? The first domain has only one nameserver, second has none and third has two. How do I set these up the postfields? There doesnt seem to be a similiar setup for the nameserver registrations as there are for the product id, among others. Does it matter in which order they come in the postfields array? Like: $postfields["domain[0]"] = "demo.com"; $postfields["nameserver1"] = "ns1.demo.com"; $postfields["nameserver2"] = "ns2.demo.com"; $postfields["nameserver3"] = "ns3.demo.com"; $postfields["nameserver4"] = "ns4.demo.com"; $postfields["domain[1]"] = "demos.com"; <= so if I placed this one after the last nameserver4, the system will abort? $postfields["nameserver1"] = "ns1.demos.com"; $postfields["nameserver2"] = "ns2.demos.com"; $postfields["nameserver3"] = "ns3.demos.com"; $postfields["nameserver4"] = "ns4.demos.com"; Can anyone tell me how the rules are behind this part of the system? Kind regards Richard
  2. Hello I would like to know if the process of domain registration/transfer happens automatically when addorder is called and processed? I have not tried this with my code, but I rather just ask here and get a good answer to how it works. Or do I have to do something like this: 1. create the array for the current order 2. call addorder and send the array as data 3. call domain registration/transfer Kind regards Richard
  3. The topic is regarding the following areas: WHMCS, validatelogin, session handling, php and classes. Hello I'm developing a PHP website for a customer and this is the first time I come in contact with WHMCS. My problem lies in that I am using a class called DatabaseHandler that does the communication with the WHMCS server, and if I use the example to connect with it I cant seem to do it. However, if I use exactly the same code but put everything inside the same PHP file, instead of using several, I can seem to get a connection. So what I need to actually connect to the database seem to wanna work. What could be the problem? Do I have to do something special when you are using several php files, one or several classes and/or several functions (to make less repetitive code)? I havent gotten a formal education in PHP, what I know I've learned by myself. I'm not using the exit statement anywhere in my PHP files, even after redirects, if that help? So the following things happen when I try to communicate with WHMCS server: Index.php starts with a session_start and then I do the include statement of the class DatabaseHandler. I create an object of the handler. I create an array to send all the information (stated below) required for accessing the server. I then call one of the public functions. The 2d array looks like this: $validateUser = array(array("action", "username", "password", "email", "password2"), array("validatelogin", "login", md5("pass"), "email", "pass")); The public function, mentioned above, comes to a line where the following function will be called (pInformation is the 2d array): $results = loadData($pInformation); loadData will now try to connect with the server and it looks like this: private function loadData($postfields) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 100); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); $data = curl_exec($ch); curl_close($ch); return $data; } Of course the $url variable contains the address to the correct API file on the client's server. All of the code works if its all in the same php file. But why doesnt it wanna work if I split the code between several php files? This is an annoying nag, especially since most of my code will work. Just this part of the design that doesnt wanna work. Thank you! Best regards Richard
×
×
  • 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