초기 커밋: 5130 레거시 시스템
- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
This commit is contained in:
29
ocr/test_api.php
Normal file
29
ocr/test_api.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
// 간단한 API 연결 테스트
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . "/session.php");
|
||||
|
||||
// 권한 체크
|
||||
if ($level > 5) {
|
||||
die(json_encode(['ok' => false, 'error' => '접근 권한이 없습니다.']));
|
||||
}
|
||||
|
||||
// API 키 읽기
|
||||
$apiKeyFile = $_SERVER['DOCUMENT_ROOT'] . '/apikey/claude_api.txt';
|
||||
|
||||
$response = [
|
||||
'file_exists' => file_exists($apiKeyFile),
|
||||
'file_path' => $apiKeyFile,
|
||||
'document_root' => $_SERVER['DOCUMENT_ROOT']
|
||||
];
|
||||
|
||||
if (file_exists($apiKeyFile)) {
|
||||
$apiKey = trim(file_get_contents($apiKeyFile));
|
||||
$response['key_length'] = strlen($apiKey);
|
||||
$response['key_prefix'] = substr($apiKey, 0, 20) . '...';
|
||||
$response['key_valid_format'] = (strpos($apiKey, 'sk-ant-api') === 0);
|
||||
} else {
|
||||
$response['error'] = 'API 키 파일을 찾을 수 없습니다.';
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($response, JSON_PRETTY_PRINT);
|
||||
Reference in New Issue
Block a user