HEX
Server: Apache
System: Linux sg2plzcpnl509433.prod.sin2.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: qhl5pt3kkb1d (10888259)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: /home/qhl5pt3kkb1d/public_html/tstp-old/web-hook.php
<?php
// Set your response content type to JSON
header('Content-Type: application/json');

// Retrieve the webhook payload (the POST data)
$payload = file_get_contents('php://input');

// Log the payload for debugging (optional)
file_put_contents('webhook_log.txt', $payload . PHP_EOL, FILE_APPEND);

// Decode the JSON payload into an associative array
$data = json_decode($payload, true);

// Process the webhook data
if ($data) {
    // Perform actions based on webhook data
    // For example, check if it's an event you're interested in:
    if (isset($data['event']) && $data['event'] == 'order_created') {
        // Handle order created event
        // You can insert the data into a database, send notifications, etc.
        // Example: $orderId = $data['order']['id'];
    }

    // Send a success response back to the webhook provider
    http_response_code(200); // HTTP 200 OK
    echo json_encode(['status' => 'success']);
} else {
    // Handle the case where the payload is empty or invalid
    http_response_code(400); // HTTP 400 Bad Request
    echo json_encode(['status' => 'error', 'message' => 'Invalid payload']);
}
?>