PHP backend test - build a http restful/json api and consume it
Using php ( no javascript ), build and consume a very basic api. All data should be exchanged using standard http parameters and/or json.
No external libraries or frameworks should be used in this programming ( only extensions available directly within a standard php installation ie. curl, http stream context, etc ).
The report back to us should include the php source code, the amount of time spent on this task, and any lookups/help searches performed.
Please record all phrases for searches performed along with any urls of pages used for reference or help ( from search or otherwise ).
Ideally, no searches or external help would be needed, creating the code by hand from memory instead.
This task should not require much time, feel free to stop at any point and report back. We do not want this task to encroach on your time. If you get to the hour mark and have not completed the code, that would be a good point to stop and report back.
In the most basic form, just two files could contain all the code
server.php ( the server side programming that will validate the key and respond to calls )
client.php ( client side that will call the server side over http ).
Server side ( server.php ) - executed through apache with mod_php
- accepts http calls
- validate an authentication key ( can be a simple post parameter as part of the api call )
- if the key is incorrect, do not give them any data and instead return an error message ( preferrably in json as well )
- if the key is correct, return a json data array with data ( ie. an array of people containing first and last names )
Client side ( client.php ) - may be executed either from apache or command line
- call the server side endpoint passing the authentication key as a post parameter
- interpret the response from the server
-- if there is an error, show the error message
-- if there is not an error, iterate over the returned data array ( using a loop ) and display the list of names