Google No captcha Recaptcha无效

Hope someone could help..i have got the widget to show for the no captcha recaptcha and i have found a code on the internet that i am trying to use because i am not that good with php but it seems to work only partially. everytime that i click the box or that i dont and i try to send an email it says please check the captcha.

this is what i have in my mail confirm.php file which is the server side (i dont think theres a need to post the widget code as it shows and works, which is step 1)

$email;$message;$sujet;$header;$captcha;
    if(isset($_POST['email'])){
      $email=$_POST['email'];
    }if(isset($_POST['message'])){
      $email=$_POST['message'];

}if(isset($_POST['sujet'])){
      $email=$_POST['sujet'];
}if(isset($_POST['header'])){
      $email=$_POST['header'];


    }if(isset($_POST['g-recaptcha-response'])){
      $captcha=$_POST['g-recaptcha-response'];
    }
    if(!$captcha){
      echo '<h2>Please check the the captcha form.</h2>';
      exit;
    }
        $response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6LcIAgETAAAAAEjbARzUsrkgBIHAeE8QmsNE3US-&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']);
    if($response.success==false)
    {
      echo '<h2>You are spammer ! Get the @$%K out</h2>';
    }
    else
    {
      echo '<h2>Thanks for posting comment.</h2>';
    }

Modify this code to your desires.

<?
    $APIkey = "API KEY";
    $postresult=$_POST['g-recaptcha-response'];
    $response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$APIkey&response=$postresult");

    if (strpos($response, 'true')){
        //Captcha is valid, do whatever.
    } else {
        //Captcha is invalid. Tell them to go away.
    }

?>