I'm attempting to create a reCAPTCHA human verification box on my website, however I cannot get past an error in my php code. I'm sure it's simple, I just can't get past it. I took out my site and private keys for security reasons.
My error when compiling:
"FATAL ERROR syntax error, unexpected ';' on line number 8"
Here's my code, thanks in advance:
<?php
if(isset($_POST['ContactButton'])){
$url = 'https://www.google.com/recaptcha/api/siteverify';
$privatekey = "--- My Private Key ---";
$response = file_get_contents($url."?secret=".$#privatekey."&response=".$_POST['g-recaptcha-response']."&remoteip=".$_SERVER['REMOTE_ADDR']);
$data = json_decode($response);
if(isset($data->success) AND $data->success==true){
////true - what happens when user is verified
header('Location: ExampleCaptcha.php?CaptchaPass=True');
}else{
////false - what happens when the user ISNT verified
header('Location: ExampleCaptcha.php?CaptchaFail=True');
}
}
?>
<html>
<head>
<title>index</title>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<body>
<form method='post' action='index.html'>
<input type='text' name='inp' /><br>
<div class="g-recaptcha" data-sitekey="--- My Site Key ---"></div><br>
<input type='submit' /><br>
</form>
</body>
</html>
if(isset($data->success) AND $data->success==true){
tryif( property_exists( $data, 'success' ) && $data->success==true ){
– Professor Abronsiusfile_get_contents
string – Martin