Search code examples
phpjoomlarecaptchajoomla3.0

reCaptcha could not open socket in joomla 3.3.1 stable


Before I ask this question, let me mention I know there are several of the exact same questions on the site but I am afraid they can't help me out.

I have Joomla! 3.3.1 Stable installed on my website krackedeggs. I also have configured reCaptcha with ALFcontact but when I submit the contact us form present at the above mentioned link, it gives the error Could not open socket. I have also implemented a possible solution present at Joomla forum by modifying recaptcha.php by replacing if (($fs = @fsockopen($host, $port, $errno, $errstr, 10)) == false ) with if (($fs = @fsockopen(gethostbyname($host), $port, $errno, $errstr, 10)) == false ) but my problem still not resolved.


Solution

  • Basically the most stupid thing about ALFcontact is that it doesn't use built-in Joomla reCaptcha plug-in, It uses its own script recaptchalib.php. So you have to edit it by going to to /components/com_alfcontact and replacing define("RECAPTCHA_VERIFY_SERVER", "www.google.com"); with

    define("RECAPTCHA_VERIFY_SERVER", gethostbyname("www.google.com"));
    

    Solution is already mentioned on many places on internet e.g on here but path to recaptchalib.php was not mentioned anywhere so most of the people went on editing recaptcha plug-in of Joomla which is perfect