128 lines
3.9 KiB
JavaScript
128 lines
3.9 KiB
JavaScript
/**
|
|
* Zeigt den exakten Scriptalizer API-Call für Tilda Font
|
|
*/
|
|
|
|
const https = require('https');
|
|
|
|
const LICENSE_KEY = 'f9918b40-d11c-11f0-b558-0800200c9a66';
|
|
const FONT_NAME = 'PremiumUltra79'; // Tilda
|
|
const ERR_FREQUENCY = 0;
|
|
const INPUT_TEXT = 'Sehr geehrte Damen und Herren,\n\nhiermit bestätigen wir Ihre Bestellung.\n\nMit freundlichen Grüßen\nIhr Skrift-Team';
|
|
|
|
// Build request body (x-www-form-urlencoded)
|
|
const params = new URLSearchParams();
|
|
params.append('LicenseKey', LICENSE_KEY);
|
|
params.append('FontName', FONT_NAME);
|
|
params.append('ErrFrequency', String(ERR_FREQUENCY));
|
|
params.append('InputText', INPUT_TEXT);
|
|
|
|
const body = params.toString();
|
|
|
|
console.log('╔════════════════════════════════════════════════════════════╗');
|
|
console.log('║ SCRIPTALIZER API CALL - TILDA FONT ║');
|
|
console.log('╚════════════════════════════════════════════════════════════╝\n');
|
|
|
|
console.log('📍 ENDPOINT:');
|
|
console.log('https://www.scriptalizer.co.uk/QuantumScriptalize.asmx/Scriptalize\n');
|
|
|
|
console.log('📋 METHOD:');
|
|
console.log('POST\n');
|
|
|
|
console.log('📦 HEADERS:');
|
|
console.log({
|
|
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
|
|
'Content-Length': Buffer.byteLength(body)
|
|
});
|
|
console.log('');
|
|
|
|
console.log('📝 REQUEST BODY (x-www-form-urlencoded):');
|
|
console.log('─'.repeat(60));
|
|
console.log(body);
|
|
console.log('─'.repeat(60));
|
|
console.log('');
|
|
|
|
console.log('📊 DECODED PARAMETERS:');
|
|
console.log({
|
|
LicenseKey: LICENSE_KEY,
|
|
FontName: FONT_NAME,
|
|
ErrFrequency: ERR_FREQUENCY,
|
|
InputText: INPUT_TEXT.substring(0, 100) + '...'
|
|
});
|
|
console.log('');
|
|
|
|
console.log('🔧 CURL COMMAND:');
|
|
console.log('─'.repeat(60));
|
|
console.log(`curl -X POST 'https://www.scriptalizer.co.uk/QuantumScriptalize.asmx/Scriptalize' \\
|
|
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \\
|
|
-d 'LicenseKey=${LICENSE_KEY}' \\
|
|
-d 'FontName=${FONT_NAME}' \\
|
|
-d 'ErrFrequency=${ERR_FREQUENCY}' \\
|
|
-d 'InputText=${INPUT_TEXT.replace(/\n/g, '\\n')}'`);
|
|
console.log('─'.repeat(60));
|
|
console.log('');
|
|
|
|
console.log('📡 SENDING REQUEST TO SCRIPTALIZER...\n');
|
|
|
|
const options = {
|
|
hostname: 'www.scriptalizer.co.uk',
|
|
port: 443,
|
|
path: '/QuantumScriptalize.asmx/Scriptalize',
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
|
|
'Content-Length': Buffer.byteLength(body)
|
|
},
|
|
timeout: 30000
|
|
};
|
|
|
|
const req = https.request(options, (res) => {
|
|
let data = '';
|
|
|
|
console.log(`📥 RESPONSE STATUS: ${res.statusCode}`);
|
|
console.log(`📥 RESPONSE HEADERS:`);
|
|
console.log(res.headers);
|
|
console.log('');
|
|
|
|
res.on('data', (chunk) => {
|
|
data += chunk;
|
|
});
|
|
|
|
res.on('end', () => {
|
|
console.log('📄 RESPONSE BODY (XML):');
|
|
console.log('─'.repeat(60));
|
|
console.log(data);
|
|
console.log('─'.repeat(60));
|
|
console.log('');
|
|
|
|
// Parse response
|
|
if (data.includes('<Status>OK</Status>')) {
|
|
console.log('✅ Status: OK');
|
|
|
|
// Extract OutputText
|
|
const outputMatch = data.match(/<OutputText>([\s\S]*?)<\/OutputText>/);
|
|
if (outputMatch) {
|
|
const outputText = outputMatch[1];
|
|
console.log('\n📝 SCRIPTALIZED TEXT (first 200 chars):');
|
|
console.log('─'.repeat(60));
|
|
console.log(outputText.substring(0, 200) + '...');
|
|
console.log('─'.repeat(60));
|
|
console.log(`\n📏 OUTPUT LENGTH: ${outputText.length} characters`);
|
|
}
|
|
} else {
|
|
console.log('❌ Error in response');
|
|
}
|
|
});
|
|
});
|
|
|
|
req.on('error', (err) => {
|
|
console.error('❌ Request error:', err.message);
|
|
});
|
|
|
|
req.on('timeout', () => {
|
|
req.destroy();
|
|
console.error('❌ Request timeout');
|
|
});
|
|
|
|
req.write(body);
|
|
req.end();
|