· 5 years ago · May 23, 2020, 11:18 AM
1<?php
2/**
3 * @file recaptcha.class.php
4 * Created by PhpStorm.
5 * @author RFO-DEV on май, 2020
6 *
7 **/
8
9class Recaptcha
10{
11 /**
12 * @var string
13 */
14 private $site_key = "ключ сайа";
15 /**
16 * @var string
17 */
18 private $secret_key = "секретный ключ";
19
20 /**
21 * @var
22 */
23 private $Return;
24
25 /**
26 * Recaptcha constructor.
27 */
28 public function __construct()
29 {
30
31 }
32
33 /**
34 * @param $SecretKey
35 * @return mixed
36 */
37 public function getCaptcha($SecretKey)
38 {
39 $Response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=" . $this->secret_key . "&response={$SecretKey}");
40 $this->Return = json_decode($Response);
41 return $this->Return;
42 }
43
44
45 /**
46 * @return string
47 */
48 public function getSiteKey()
49 {
50 return $this->site_key;
51 }
52}