mirror of
https://github.com/FxPouya/FxMathQuantWebApp.git
synced 2026-07-27 18:27:44 +00:00
116 lines
3.2 KiB
HTML
116 lines
3.2 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<title>API Test - Trial License</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
max-width: 800px;
|
|
margin: 50px auto;
|
|
padding: 20px;
|
|
}
|
|
|
|
.test-box {
|
|
background: #f5f5f5;
|
|
padding: 20px;
|
|
border-radius: 8px;
|
|
margin: 20px 0;
|
|
}
|
|
|
|
button {
|
|
background: #667eea;
|
|
color: white;
|
|
border: none;
|
|
padding: 10px 20px;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
font-size: 16px;
|
|
}
|
|
|
|
button:hover {
|
|
background: #5568d3;
|
|
}
|
|
|
|
.result {
|
|
margin-top: 20px;
|
|
padding: 15px;
|
|
border-radius: 5px;
|
|
white-space: pre-wrap;
|
|
font-family: monospace;
|
|
}
|
|
|
|
.success {
|
|
background: #d4edda;
|
|
border: 1px solid #c3e6cb;
|
|
color: #155724;
|
|
}
|
|
|
|
.error {
|
|
background: #f8d7da;
|
|
border: 1px solid #f5c6cb;
|
|
color: #721c24;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<h1>Trial License API Test</h1>
|
|
|
|
<div class="test-box">
|
|
<h3>Test 1: Local API</h3>
|
|
<p>Tests: <code>http://localhost/FxMathQuant-Server/api/create.php</code></p>
|
|
<button onclick="testAPI('local')">Test Local API</button>
|
|
<div id="result-local"></div>
|
|
</div>
|
|
|
|
<div class="test-box">
|
|
<h3>Test 2: Production API</h3>
|
|
<p>Tests: <code>https://fxmath.com/quantw/api/create.php</code></p>
|
|
<button onclick="testAPI('production')">Test Production API</button>
|
|
<div id="result-production"></div>
|
|
</div>
|
|
|
|
<script>
|
|
async function testAPI(type) {
|
|
const urls = {
|
|
local: 'http://localhost/FxMathQuant-Server/api/create.php',
|
|
production: 'https://fxmath.com/quantw/api/create.php'
|
|
};
|
|
|
|
const resultDiv = document.getElementById('result-' + type);
|
|
resultDiv.innerHTML = '<p>Testing...</p>';
|
|
|
|
const testEmail = 'test' + Date.now() + '@example.com';
|
|
|
|
try {
|
|
const response = await fetch(urls[type], {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({
|
|
is_trial: true,
|
|
email: testEmail
|
|
})
|
|
});
|
|
|
|
const data = await response.json();
|
|
|
|
let resultHTML = `<div class="${data.success ? 'success' : 'error'} result">`;
|
|
resultHTML += `<strong>Status:</strong> ${response.status}\n\n`;
|
|
resultHTML += `<strong>Response:</strong>\n${JSON.stringify(data, null, 2)}`;
|
|
resultHTML += `</div>`;
|
|
|
|
resultDiv.innerHTML = resultHTML;
|
|
|
|
} catch (error) {
|
|
resultDiv.innerHTML = `<div class="error result">
|
|
<strong>Error:</strong>\n${error.message}
|
|
</div>`;
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
|
|
</html> |