Remitur Posted September 6, 2022 Share Posted September 6, 2022 (edited) Hello.  I'm writing a hook that need to do a CURL towards an external site. Very same PHP code (out of WHMCS but in the very same hosting space) works fine, but that code inserted into an hook get just a "404 error"...  😟 The code is this: if (!defined("WHMCS")) die("This file cannot be accessed directly"); function checkuserdata($vars) { logActivity('here I am', 0); $email = $vars['email']; // https://www.mailcheck.ai/ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://api.mailcheck.ai/eamail/' . $email); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); curl_close($ch); $response2=json_decode($response); $debug = var_export($response2, true); logActivity("response: ".$response, 0); logActivity("debug: ".$debug, 0); if ($response2->disposable OR !$response2->mx) { array_push($errors, "Your email address is not valid"); } return $errors; } add_hook("ClientDetailsValidation",1,"checkuserdata"); So, I guess... same option in curl_setopt needs to be configured someway different, but... what option? (note: this call to mailcheck.ai is used to check not only the validity of the user's email address, but also that he is not using a disposable email for some kind of fraud attempt) Edited September 6, 2022 by Remitur 0 Quote Link to comment Share on other sites More sharing options...
bear Posted September 6, 2022 Share Posted September 6, 2022 You have a typo. eamail 1 Quote Link to comment Share on other sites More sharing options...
leemahoney3 Posted September 6, 2022 Share Posted September 6, 2022 Yeah should be https://api.mailcheck.ai/email/ and not  https://api.mailcheck.ai/eamail/ 1 Quote Link to comment Share on other sites More sharing options...
Remitur Posted September 6, 2022 Author Share Posted September 6, 2022 @bear and @leemahoney3, thanks!!!! (I want an A.I. based code editor, in order to remedy my natural stupidity... 😀 ) 1 Quote Link to comment Share on other sites More sharing options...
bear Posted September 6, 2022 Share Posted September 6, 2022 I chalk it up to spell check, my arch nemesis. 😉 (seriously, Android...you changed Kayden to Valusia? How is that even close?) 1 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.