$response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secret."&response=".$response); $response = json_decode($response, true); if($response["success"] === true){ // actions if successful }else{ // actions if failed }