28 lines
759 B
PHP
28 lines
759 B
PHP
<?php
|
|
$data = [
|
|
'action' => 'create',
|
|
'patient_id' => 2,
|
|
'doctor_id' => 1,
|
|
'nurse_id' => null,
|
|
'visit_type' => 'Clinic',
|
|
'address' => '',
|
|
'start_time' => '2026-03-25T10:00',
|
|
'reason' => 'Test API'
|
|
];
|
|
|
|
$ch = curl_init('http://localhost/api/appointments.php');
|
|
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']);
|
|
|
|
$response = curl_exec($ch);
|
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
|
|
|
if ($response === false) {
|
|
echo "Curl Error: " . curl_error($ch);
|
|
} else {
|
|
echo "HTTP Code: $http_code\n";
|
|
echo "Response: $response\n";
|
|
}
|
|
curl_close($ch); |