self::URL, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => array( 'secret' => $secretKey, 'response' => $token ), ]); $response = json_decode(curl_exec($ch), true); curl_close($ch); if (!$response['success'] || $response['action'] != $action) { return false; } return $response['score']; } }