How to Use PHP to Return the Date in JSON Format
These functions, json_encode() and json_decode(), make it easy to work with JSON and create JSON web services from PHP.
A simple way to get your feet wet with web services is to return a date in JSON format. Here's how you can do that:
Open your text editor or programming IDE and create a new empty file.
Place the following code within the file:
<?php $header = "Content-Type: application/json"; header($header); $date = date("M d, Y"); print json_encode($date); ?>
Save the file as date.php in your web server's document root.
View the page in your web browser at http://localhost/date.php.
You should see a page like that shown here (though the date will probably be different).