$boxUrl, 'file_id' => $fileId, 'username' => $username, 'timestamp' => date('Y-m-d H:i:s') ]; // Initialize cURL session $ch = curl_init($webhookUrl); // Set cURL options curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json' ]); // Execute cURL request $response = curl_exec($ch); // Check for errors if (curl_errno($ch)) { $error = 'cURL Error: ' . curl_error($ch); } else { $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($httpCode >= 200 && $httpCode < 300) { $result = json_decode($response, true); } else { $error = "HTTP Error: $httpCode - $response"; } } // Close cURL session curl_close($ch); } else { $error = "Could not extract file ID from the provided Box URL."; } } ?>
Box URL:
File ID: