GNU/_PAGE/chart/upbit/candles/upbit_proxy_candles.php
<?php
// upbit_proxy_candles.php (형 전용 안정 버전)

header("Content-Type: application/json; charset=utf-8");

$market = $_GET["market"] ?? "KRW-BTC";
$type   = $_GET["type"]   ?? "minutes";
$unit   = $_GET["unit"]   ?? 1;
$count  = $_GET["count"]  ?? 200;

if ($type === "days") {
    $url = "https://api.upbit.com/v1/candles/days?market=$market&count=$count";
} else {
    $url = "https://api.upbit.com/v1/candles/minutes/$unit?market=$market&count=$count";
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$res = curl_exec($ch);
$err = curl_error($ch);
curl_close($ch);

if ($err) {
    echo json_encode(["error" => $err]);
    exit;
}

echo $res;
?>