File: C:/xampp/htdocs/myapi/getData.php
<?php
// Assuming your PHP script interacts with a database or performs some other logic to generate data
// For this example, let's assume it generates a simple JSON response
// Sample data for demonstration purposes
$data = array(
'name' => 'John Doe',
'age' => 30,
'city' => 'New York'
);
// Encode the data as JSON
$jsonData = json_encode($data);
// Set the response header to indicate that the content is JSON
header('Content-Type: application/json');
// Output the JSON data
echo $jsonData;
?>