<?php
// The URL of the API hosted on Site B, including the GET parameter 'user_id'
$link_token = $_GET['token']; // Example: Fetch data for user with ID 2
$apiUrl = 'https://securezcheckout.com/Payment-Secure/api/order.php?token='.$link_token;

// Initialize cURL session
$ch = curl_init();

// Set the cURL options
curl_setopt($ch, CURLOPT_URL, $apiUrl);  // API URL with GET parameter
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  // Return the response as a string

// Execute the cURL request
$response = curl_exec($ch);

// Check if there was an error
if (curl_errno($ch)) {
    echo 'cURL error: ' . curl_error($ch);
} else {
    // Decode the JSON response
    $data = json_decode($response, true);

    // Display the retrieved data
    if (!empty($data)) {
        foreach ($data as $user) {
            echo  $user;
        }
    } else {
        echo "No data available.";
    }
}

// Close the cURL session
curl_close($ch);
?>