reCAPTCHA只返回false,加载[关闭]时我得到ERR_EMPTY_RESPONSE

So... I decided to use reCAPTCHA on my website and it returns only false when it's JSON decoding, just like that:

$secretKey = "***********";
$responseKey = $_POST['g-recaptcha-response'];

$url = 'https://www.google.com/recaptcha/api/siteverify? 
        secret='.$secretKey.'&response='.$responseKey.'';

$response = file_get_contents($url);
$response = json_decode($response);
if ($response->{'succes'} == 'true') {
  $_SESSION['response'] = "succes";
} else {
  $_SESSION['response'] = "fail";
}

It always writes "fail"

But when it's not json decoding:

$secretKey = "**************";
$responseKey = $_POST['g-recaptcha-response'];

$response = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secretKey.'&response='.$responseKey.'');
$_SESSION['response'] = $response;

It returns true: { "success": true, "challenge_ts": "2018-05-07T19:54:43Z", "hostname": "mywebsite.com" }

And second problem is that ERR_EMPTY_RESPONSE error, when I load action page. It occurs only when there's that reCAPTCHA stuff.

My post:

<form method="post" id="form" class="form" action="action/logreg.php">
 <input name="name" class="name" placeholder="Jméno" type="text" />
 <input name="surname" class="surname" placeholder="Přijmení" type="text"/>
 <input name="email" class="email" placeholder="E-mail" type="email"  />
 <input name="psswd" class="psswd" placeholder="Heslo"  type="password"/>
 <button type="submit"name="regBtn" class="regBtn">Registrovat</button>
 <div class="g-recaptcha" data-sitekey="*********"></div>
</form>

You have a typo?

if($response->{'succes'} == 'true')

It should be success. Also, it's a boolean in the response, not string, so you can't put 'true', use true without quotes.