From dcd2f964291fedaa9107ac4fa2dcd7c9b626580c Mon Sep 17 00:00:00 2001 From: DJP Date: Thu, 23 Oct 2025 14:58:53 -0400 Subject: [PATCH] Add comprehensive debug output for troubleshooting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added debug information section that displays after POST - Shows raw webhook response and HTTP code - Displays decoded result and JSON decode errors - Shows state of $result and $error variables - Helps identify why results aren't displaying 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- index.php | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/index.php b/index.php index 00b2786..d81be84 100644 --- a/index.php +++ b/index.php @@ -22,6 +22,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $fileId = extractBoxFileId($boxUrl); $result = null; $error = null; + $debugInfo = []; // Debug information if ($fileId) { // Prepare data for webhook @@ -32,9 +33,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { 'timestamp' => date('Y-m-d H:i:s') ]; + $debugInfo['sent_data'] = $data; + // Initialize cURL session $ch = curl_init($webhookUrl); - + // Set cURL options curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); @@ -42,22 +45,28 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json' ]); - + // Execute cURL request $response = curl_exec($ch); - + $debugInfo['raw_response'] = $response; + // Check for errors if (curl_errno($ch)) { $error = 'cURL Error: ' . curl_error($ch); + $debugInfo['curl_error'] = curl_error($ch); } else { $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + $debugInfo['http_code'] = $httpCode; + if ($httpCode >= 200 && $httpCode < 300) { $result = json_decode($response, true); + $debugInfo['decoded_result'] = $result; + $debugInfo['json_decode_error'] = json_last_error_msg(); } else { $error = "HTTP Error: $httpCode - $response"; } } - + // Close cURL session curl_close($ch); } else { @@ -317,6 +326,44 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { + + +
+

🔍 DEBUG INFORMATION

+ +
+ POST Request Received: Yes
+ Box URL:
+ Username:
+ File ID:
+
+ + +
+

Debug Info:

+
+
+ + +
+

$result variable:

+ isset($result):
+ is_null($result):
+ Type:
+ +
+ +
+ +
+

$error variable:

+ isset($error):
+ Value: +
+
+ + +

Result