Description
Implement a simple RESTful web service by using PHP.
Your web service should provide information about books.
http://localhost/books should give list of books that are stored in your database.
Response generated by the web service can be in JSON or XML format.
Your database (database name: PW6) will have following table:
Book (Book_id, title, year, price, category)
You can use books.xml to populate your table.
Deliverables: Zip index.php and screenshot of your result into yournetid-PW6.zip and send through eLearning.
***
You will need to configure your MAMP server to make it compatible with REST.
How to configure MAMP for Mac OS:
Create api folder under /Applications/MAMP/htdocs directory.
Save index.php under /Applications/MAMP/htdocs/api directory.
Add below line to /Applications/MAMP/conf/apache/httpd.conf file:
Alias /books “/Applications/MAMP/htdocs/api/index.php”
How to configure MAMP for Windows:
Create api folder under C:/MAMP/htdocs directory.
Save index.php under C:/MAMP/htdocs/api directory.
Add below line to C:/MAMP/conf/apache/httpd.conf file:
Alias /books “C:/MAMP/htdocs/api/index.php”
Restart apache server.
Check your api at http://localhost/books.
Important reminder: Make sure your database name, table name and attribute names match with given names. You also make sure to use default hostname, username and password for database connection. (host: localhost, username: root, password: root). Otherwise you will lose points for not complying with the standards of the assignment.