Files
html/api/ethica-proxy.php
2026-04-12 22:57:03 +02:00

16 lines
699 B
PHP

<?php
// Proxy to S95 Ethica API (avoids CORS)
header('Content-Type: application/json');
$token = $_GET['token'] ?? '';
if($token !== 'ETHICA_API_2026_SECURE') { echo '{"error":"unauthorized"}'; exit; }
$action = $_GET['action'] ?? 'status';
$url = "http://10.1.0.3:5890/api/ethica-crossvalidator-api.php?token=$token&action=" . urlencode($action);
if(isset($_GET['limit'])) $url .= "&limit=" . intval($_GET['limit']);
$ch = curl_init($url);
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER=>true, CURLOPT_TIMEOUT=>15]);
$resp = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if($code !== 200) { echo '{"error":"upstream_error","code":'.$code.'}'; exit; }
echo $resp;