<?php
// API URL where you want to send the POST request
$url = 'https://mall.zhopper2u.com/api/register';  // Replace with the actual URL

// Data to send in the POST request
$data = [
    'username' => 'AAAA',
    'password' => '123456',
    'fullname' => 'test',
    'email' => 'cc@gmail.com',
    'directname' => 'acc1101',
    'country' => 'Malaysia'
];

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

// Set cURL options
curl_setopt($ch, CURLOPT_URL, $url);               // URL to send the request to
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);    // Return the response as a string
curl_setopt($ch, CURLOPT_POST, true);              // Use POST method
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));  // Data to send
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json' // Content type header
]);

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

// Check for errors in cURL request
if(curl_errno($ch)) {
    echo 'Curl error: ' . curl_error($ch);
} else {
    // Output the response from the server
    echo 'Response: ' . $response;
}

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