1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
<?php session_start();
$client_id = "mMt2llKaVO0qNS6SW0cm"; // 네이버 개발자센터에서 발급받은 CLIENT ID $client_secret = "rTLSOqN91F";// 네이버 개발자센터에서 발급받은 CLIENT SECRET $code = "1"; $key = $_SESSION['CAPTCHA_KEY']; $value = $_POST['naver_captcha']; $url = "https://openapi.naver.com/v1/captcha/nkey?code=".$code."&key=".$key."&value=".$value; $is_post = false; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, $is_post); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $headers = array(); $headers[] = "X-Naver-Client-Id: ".$client_id; $headers[] = "X-Naver-Client-Secret: ".$client_secret; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec ($ch); $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close ($ch); //echo $status_code; if($status_code == 200) { $json = json_decode($response); if($json->result=="true"){ $responseKeys["success"] = 1; } else { $responseKeys["success"] = 0; } } else { echo "Error 내용:".$response; $responseKeys["success"] = 0; } echo $_SESSION['CAPTCHA_KEY']." / ".$_POST['naver_captcha']." / ".$responseKeys["success"]; ?>
|