I'm trying to increment a reCAPTCHA on a website, I've watched several step by step, but mine persists in giving the same error. example code:
index.php
<html xmlns="http://www.w3.org/1999/html">
<head>
<title>index</title>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<body>
<form method="post" action="verify.php">
<input type="text" name="inp"/></br>
<div class="g-recaptcha" data-sitekey="********************"></div>
<input type="submit"></br>
</form>
</body>
</html>
verify.php
<?php
header("Content-type: text/php charset=utf-8");
if(isset($_POST['g-recaptcha-response'])&& $_POST['g-recaptcha-response']){
var_dump($_POST);
//informações sobre o reCAPTCHA
$secret = "**************************************************";
var_dump($secret);
$ip = $_SERVER['REMOTE_ADDR'];
var_dump($_SERVER);
$captcha = $_POST['g-recaptcha-response'];
var_dump($captcha);
//Enviar para o google
$rps = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$secret&response=$captcha&remoteip$ip");
//resposta google
var_dump($rps);
// $arr = json_decode($rsp,true)
}else{
echo "reCAPTCHA não prenchido";
}
The error always occurs in
$rps = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$secret&response=$captcha&remoteip$ip");
The var_dump($rps);
should return "success": true
but always returns
Warning : file_get_contents () [function.file-get-contents]: URL file-access is disabled in the server configuration in /home/storage/2/8a/81/necon1/public_html/verify.php on line 13