Rubens Kuhl Posted May 16, 2023 Share Posted May 16, 2023 I am developing a registrar module specific to a single TLD, and it seems that lookup provider idea was based on the assumption that the registrar module would handle availability checks for all TLDs. So, I need to find a way to either: 1) Have WHMCS standard NameSpinner do the lookups but for some TLDs, call the module CheckAvailability function 2) Have the registrar module handle all the lookups, but calling NameSpinner when outside its own remit. Is any of those options feasible ? Thanks, Rubens 0 Quote Link to comment Share on other sites More sharing options...
Rubens Kuhl Posted May 20, 2023 Author Share Posted May 20, 2023 Besides the interoperability with other TLDs/registrars module issue above, even for a single TLD deployment the CheckAvailability functions are not working. The availability check never ends. The current CheckAvailability function looks like this: function registrobr_CheckAvailability($params) { // registrar configuration values $target = ($params['TestMode'] == 'Beta') ? 'https://beta.registro.br/v2/ajax/avail/raw/' : 'https://registro.br/v2/ajax/avail/raw/' ; // availability check parameters $searchTerm = $params['searchTerm']; $tldsToInclude = $params['tldsToInclude']; array_push ($tldsToInclude,$params['tld']); $tldsToInclude = array_unique($tldsToInclude); if (!set($searchTerm)) { $searchTerm = $params['sld']; } logModuleCall('registrobr', 'Avail before ResultsList', $searchTerm , $tldsToInclude,'',''); $results = new ResultsList(); logModuleCall('registrobr', 'Avail after ResultsList', $searchTerm , $tldsToInclude,'',''); foreach ($tldsToInclude as $tld) { try { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $target . $searchTerm . $tld); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 100); $response = curl_exec($ch); logModuleCall('registrobr', 'Avail after curl', $target . $searchTerm . $tld , $response,'',''); if (curl_errno($ch)) { throw new \Exception('Connection Error: ' . curl_errno($ch) . ' - ' . curl_error($ch)); } curl_close($ch); $result = json_decode($response, true); if ($result === null && json_last_error() !== JSON_ERROR_NONE) { throw new \Exception('Bad response received from Ajax Avail'); } $searchResult = new SearchResult($searchTerm, $tld); switch ($result['status']) { case 0: $searchResult->setStatus(SearchResult::STATUS_NOT_REGISTERED); break; case 2: $searchResult->setStatus(SearchResult::STATUS_REGISTERED); break; case 1: case 3: case 5: case 6: case 7: case 9: $searchResult->setStatus(SearchResult::STATUS_RESERVED); break; case 4: case 8: default: $searchResult->setStatus(SearchResult::STATUS_UNKNOWN); break; $results->append($searchResult); } } catch (\Exception $e) { return array( 'error' => $e->getMessage(), ); } } return $results; } None of the log entries that logModuleCall would trigger ever happens. So there is something else happening in WHMCS before that is causing this. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.