1

EDITED: I have registered my domain in admin panel

blabla.org

but it still not worked

so i have some process with google recaptcha verification.

but when i click the button process.

$response cant detected and it given null content.

here is my code

$site_key = 'secret';
$secret_key = secret'; 
if(isset($_POST['req_token'])){ 
    if(isset($_POST['g-recaptcha-response']))
       {
       $api_url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . $secret_key . '&response='.$_POST['g-recaptcha-response'];
       $response = file_get_contents($api_url);
       $data = json_decode($response);
        if($data['success'])
           {
            $nama                       =$_POST['nama'];
            $email                      =$_POST['email'];
            $telp_1                     =$_POST['telp_1'];
            $status_id                  = 1;
           $sql="INSERT INTO data_recruitment
                                       (   status_id,
                                           nama,
                                           email,
                                           telp_1
                                       )
                                       VALUES
                                       (   '$status_id',
                                           '$nama',
                                           '$email',
                                           '$telp_1'
                                       )";
                                       if(mysqli_query($conn, $sql)){ // jika query insert berhasil dieksekusi
                                       header("location:../index.php?status=1");
                                       }
                                       else{
                                       header("location:../index.php?status=2");
                                       }    
        } else
        {
               header("location:../index.php?status=4");
           }
    }
   else{
           header("location:../index.php?status=3");
   }  
}

$response not detected in my server. but when i tested in localhost. the process working fine.

any suggestion?

1 Answers1

0

Did you take a look at this? file_get_contents returns empty string

You might want to do a phpinfo() and see what version your server is running.

MountainAsh
  • 428
  • 6
  • 12