diff --git a/Profice WebSite/backup-form.html b/Profice WebSite/backup-form.html
deleted file mode 100644
index 58f26a2..0000000
--- a/Profice WebSite/backup-form.html
+++ /dev/null
@@ -1,130 +0,0 @@
-
-
-
-
-
- Kontaktformular - Profice
-
-
-
-
-
-
-
-
diff --git a/Profice WebSite/index.html b/Profice WebSite/index.html
index 8e40a4c..ebe51e8 100644
--- a/Profice WebSite/index.html
+++ b/Profice WebSite/index.html
@@ -562,13 +562,21 @@
}
async function testPHP() {
- logDebug('Testing PHP connection...');
+ logDebug('Testing PHP & Webhook...');
try {
const response = await fetch('scripts/add/test.php');
if (response.ok) {
const result = await response.json();
- logDebug(`✓ PHP OK: ${result.message}`);
- logDebug(`PHP Version: ${result.server_info?.php_version || 'Unknown'}`);
+ logDebug(`PHP: ${result.tests?.php?.version || 'OK'}`);
+ logDebug(`cURL: ${result.tests?.curl?.status || 'unknown'}`);
+ if (result.tests?.webhook) {
+ const wh = result.tests.webhook;
+ if (wh.status === 'ok') {
+ logDebug(`✓ Webhook: HTTP ${wh.http_code}`);
+ } else {
+ logDebug(`✗ Webhook: ${wh.error || 'HTTP ' + wh.http_code}`, true);
+ }
+ }
} else {
logDebug(`✗ PHP Error: HTTP ${response.status}`, true);
}
diff --git a/Profice WebSite/scripts/add/send.php b/Profice WebSite/scripts/add/send.php
index 2090e22..7c4e7e6 100644
--- a/Profice WebSite/scripts/add/send.php
+++ b/Profice WebSite/scripts/add/send.php
@@ -45,7 +45,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
// Environment
define('USE_PRODUCTION', true); // Use production webhook for live server
-define('DEBUG_MODE', false); // Disable debug for production
+define('DEBUG_MODE', true); // Enable debug temporarily to see errors
// N8N Webhooks
define('WEBHOOK_TEST', 'https://n8n.profice.de/webhook-test/d94ef798-3f43-46dd-8207-1e335e64518f');
@@ -193,18 +193,20 @@ function sendToWebhook($data, $webhookUrl = null) {
'User-Agent: Profice-Web-API/2.0'
],
CURLOPT_TIMEOUT => 30,
- CURLOPT_SSL_VERIFYPEER => !DEBUG_MODE, // Disable for debugging
+ CURLOPT_SSL_VERIFYPEER => false, // Disable SSL verification for n8n connection
+ CURLOPT_SSL_VERIFYHOST => false, // Disable host verification
CURLOPT_FOLLOWLOCATION => true
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
+ $errno = curl_errno($ch);
curl_close($ch);
if ($error) {
- error_log("Webhook Error: " . $error);
- return ['success' => false, 'error' => $error, 'response' => $response];
+ error_log("Webhook Error [$errno]: " . $error . " - URL: " . $url);
+ return ['success' => false, 'error' => $error, 'errno' => $errno, 'response' => $response];
}
return [
diff --git a/Profice WebSite/scripts/add/test.php b/Profice WebSite/scripts/add/test.php
index 7a301ff..2e2ac22 100644
--- a/Profice WebSite/scripts/add/test.php
+++ b/Profice WebSite/scripts/add/test.php
@@ -1,13 +1,85 @@
true,
- 'message' => 'PHP is working correctly',
'timestamp' => date('c'),
- 'server_info' => [
- 'php_version' => phpversion(),
- 'server_software' => $_SERVER['SERVER_SOFTWARE'] ?? 'Unknown'
- ]
-]);
-?>
+ 'tests' => []
+];
+
+// Test 1: PHP Version
+$results['tests']['php'] = [
+ 'status' => 'ok',
+ 'version' => phpversion(),
+ 'server' => $_SERVER['SERVER_SOFTWARE'] ?? 'Unknown'
+];
+
+// Test 2: cURL Extension
+$results['tests']['curl'] = [
+ 'status' => extension_loaded('curl') ? 'ok' : 'error',
+ 'message' => extension_loaded('curl') ? 'cURL extension loaded' : 'cURL extension NOT loaded - webhooks will fail!'
+];
+
+// Test 3: JSON Extension
+$results['tests']['json'] = [
+ 'status' => extension_loaded('json') ? 'ok' : 'error',
+ 'message' => extension_loaded('json') ? 'JSON extension loaded' : 'JSON extension NOT loaded'
+];
+
+// Test 4: Test webhook connection
+if (extension_loaded('curl')) {
+ $webhookUrl = 'https://n8n.profice.de/webhook/d94ef798-3f43-46dd-8207-1e335e64518f';
+
+ $testData = [
+ 'type' => 'connection_test',
+ 'timestamp' => date('c'),
+ 'source' => 'test.php'
+ ];
+
+ $ch = curl_init();
+ curl_setopt_array($ch, [
+ CURLOPT_URL => $webhookUrl,
+ CURLOPT_RETURNTRANSFER => true,
+ CURLOPT_POST => true,
+ CURLOPT_POSTFIELDS => json_encode($testData),
+ CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
+ CURLOPT_TIMEOUT => 10,
+ CURLOPT_SSL_VERIFYPEER => false,
+ CURLOPT_SSL_VERIFYHOST => false
+ ]);
+
+ $response = curl_exec($ch);
+ $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+ $error = curl_error($ch);
+ $errno = curl_errno($ch);
+ curl_close($ch);
+
+ $results['tests']['webhook'] = [
+ 'status' => ($httpCode >= 200 && $httpCode < 300) ? 'ok' : 'error',
+ 'http_code' => $httpCode,
+ 'url' => $webhookUrl,
+ 'error' => $error ?: null,
+ 'error_code' => $errno ?: null,
+ 'response_preview' => substr($response, 0, 200)
+ ];
+
+ if ($error) {
+ $results['success'] = false;
+ }
+} else {
+ $results['tests']['webhook'] = [
+ 'status' => 'skipped',
+ 'message' => 'cURL not available'
+ ];
+ $results['success'] = false;
+}
+
+// Test 5: File permissions
+$results['tests']['permissions'] = [
+ 'status' => is_writable(dirname(__FILE__)) ? 'ok' : 'warning',
+ 'message' => is_writable(dirname(__FILE__)) ? 'Directory writable' : 'Directory not writable (may affect logging)'
+];
+
+echo json_encode($results, JSON_PRETTY_PRINT);