reCAPTCHA through a proxy - a solution that worked for me

3,164 views
Skip to first unread message

GungaDan

unread,
Jun 25, 2008, 12:15:29 PM6/25/08
to reCAPTCHA
Hello all,

I know this has been brought a few times but this might help those
struggling to use recaptcha from behind a proxy and who, like me, have
been seeing the dreaded "Could not open socket" error message.

Having given up on the group because I'm too thick to interpret the
solutions presented here, I resorted to Google and found this page:

http://www.greenhughes.com/content/recaptcha-drupal-and-proxy-way-make-it-all-work-together#comment-120

Although this is aimed at Drupal users, the second half of the
solution describes modifications to the recaptchalib.php which worked
fine for me. I'll copy the text here:

Find the function named _recaptcha_http_post() and comment out this
line:
$http_request = "POST $path HTTP/1.0\r\n";

Now add this line beneath it:
$http_request = "POST http://".$host.":".$port.$path." HTTP/1.1\r\n";

To finish off the new request comment out this line:
if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) )
{

..and add this below it:
if( false == ( $fs = @fsockopen("YOUR PROXY HOST", "YOUR PROXY PORT",
$errno, $errstr, 15) ) ) {

Hope that helps someone!

Dan



Message has been deleted

Wahab Hussain

unread,
Feb 15, 2012, 4:30:55 AM2/15/12
to reca...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages