A3.2 API to Add a Place |
|
Using the following to create an API named add_place.php. The PHP program will accept a query string of name value pair arguments for (campus, cuisine, place), then add a place to the database. Your API should return a JSON object containing the error code and accompanying message. Use the same parameter names. <?php $user = '*****'; $campus = 'UHWO'; // Fill in with a campus when testing from the command line $cuisine = ''; $place = 'Himalayan Kitchen'; // Fill in with a place when testing from the command line if($campus>'' && $place>'') { $dsn = "mysql:host=$host;dbname=$database"; $out= json_encode( To test your API you can use the same tests you used to test your ADD_PLACE routine. First you may have to delete Himalayan Kitchen as the favorite Nepalese at UHWO if it is still present in your database.
|