56 lines
1.6 KiB
PHP
56 lines
1.6 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../config.php';
|
|
|
|
echo "<h2>Debug Information</h2>";
|
|
echo "<p><strong>API_BASE:</strong> " . htmlspecialchars(API_BASE) . "</p>";
|
|
|
|
echo "<h3>PHP Version:</h3>";
|
|
echo phpversion() . "<br><br>";
|
|
|
|
echo "<h3>CURL Support:</h3>";
|
|
echo (extension_loaded('curl') ? 'YES' : 'NO') . "<br><br>";
|
|
|
|
echo "<h3>JSON Support:</h3>";
|
|
echo (extension_loaded('json') ? 'YES' : 'NO') . "<br><br>";
|
|
|
|
echo "<h3>OpenSSL Support:</h3>";
|
|
echo (extension_loaded('openssl') ? 'YES' : 'NO') . "<br><br>";
|
|
|
|
echo "<h3>Error Log Location:</h3>";
|
|
echo ini_get('error_log') . "<br><br>";
|
|
|
|
echo "<h3>Last 20 Error Log Entries:</h3>";
|
|
$log_file = ini_get('error_log');
|
|
if (file_exists($log_file)) {
|
|
$log_entries = file_get_contents($log_file);
|
|
$lines = explode("\n", $log_entries);
|
|
$recent_lines = array_slice($lines, -20);
|
|
foreach ($recent_lines as $line) {
|
|
if (trim($line) && strpos($line, 'API') !== false) {
|
|
echo htmlspecialchars($line) . "<br>";
|
|
}
|
|
}
|
|
} else {
|
|
echo "Error log file not found<br>";
|
|
}
|
|
|
|
echo "<h3>Test Direct API Call:</h3>";
|
|
$url = API_BASE . 'login';
|
|
$data = json_encode(['username' => 'admin', 'password' => 'admin']);
|
|
|
|
$context = stream_context_create([
|
|
'http' => [
|
|
'method' => 'POST',
|
|
'header' => 'Content-Type: application/json',
|
|
'content' => $data,
|
|
'timeout' => 10
|
|
]
|
|
]);
|
|
|
|
$result = file_get_contents($url, false, $context);
|
|
echo "Result: " . htmlspecialchars($result) . "<br>";
|
|
|
|
if ($http_response_header) {
|
|
echo "Headers: " . implode('<br>', $http_response_header) . "<br>";
|
|
}
|