file_get_contents Not allowed on my web server, can't get captcha 2.0 to work. Options?

1,552 views
Skip to first unread message

Velissala lvl100pally

unread,
Jan 13, 2016, 1:07:49 PM1/13/16
to reCAPTCHA
Hi All,

I had been using v1.0 without an issue with PHP and am trying to upgrade to captcha 2.0.

My web site is on the University's server, I have no control of the original PHP set up and certain things have been disabled per their discretion.

What I'm running into is this failure notice:

Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /global/httpd/vol1/sites/(addressremovedbyme).edu/breakfast_process.php on line 18

Warning: file_get_contents(https://www.google.com/recaptcha/api/siteverify?secret=6LcbQRUTAAAAABzvbAwqLGS80m1ZugF8sj3lZhAf&response=&remoteip=10.2.12.125): failed to open stream: no suitable wrapper could be found in/global/httpd/vol1/sites/(addressremovedbyme).edu/breakfast_process.php on line 18

My server side code - the line it's having an issue with is in red, MY KEY replaces my actual key of course:

if(isset($_POST['g-recaptcha-response']))
  {
  $captcha=$_POST['g-recaptcha-response'];
  }
       
if(!$captcha)
 {
  echo '<h2>Please check the the captcha form.</h2>';
 }
        
$response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=MY KEY&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']);
        if($response.success==false)
        {
echo "Spammer etc.";
}
        else
        {etc.

Since my university most likely will not make any changes to the PHP server side what are my options?  Detailed examples most welcome. :)

Thanks!

Robin
Reply all
Reply to author
Forward
0 new messages