/home/mjc1/public_html/inc_pack/CAPTCHA/confirm_inc3.php


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
<?php
    $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($chCURLOPT_URL$url);
    
curl_setopt($chCURLOPT_POST$is_post);
    
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
    
$headers = array();
    
$headers[] = "X-Naver-Client-Id: ".$client_id;
    
$headers[] = "X-Naver-Client-Secret: ".$client_secret;
    
curl_setopt($chCURLOPT_HTTPHEADER$headers);
    
$response curl_exec ($ch);
    
$status_code curl_getinfo($chCURLINFO_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;
    }
?>