The task is about using PHP, database (any RDMS), parsing XML and printing output.
You are asked to create a simple PHP page, where user can insert (manually from keyboard) a number of an meeting agenda (XML file). There are two XML files attached to this task, but consider as if there could be more (so no dropdown box).
Example: The meetings file is data_1011.xml is fetched via typing “1011” and pressing submit button.
Next to a input field there should be a button (simple submit button), pressing which should return meeting’s basic information parsed from XML file (the call should happen via AJAX). The parsing should be efficient (hint: substring is not efficient enough here).
The information to be printed is following (see XML file, only bold part should be printed):
<event name="meeting"> <fields>
<field name="Planning meeting"/>
<field sysid="1054"/>
<field date="2020-03-23 10:00"/>
</fields>
</event>
The paths to the XML files are stored in the database, so when user presses submit button the right path of the XML file should be looked up in the database. Use a simple table for that (with couple of fields). Think about how can the search can be improved for future, if we have many entries (hint: use some of database features to increase the search speed).
Please think about the page security, even very smart user should not be able to do more with a page, than just request the meeting’s information based on number and see it.
You are expected to send back:
- PHP/JS files
- db script (with table initialization and data adding XML files paths) Please look carefully at the comments in italic.
First check ports 8080 and 8000 are free
git clone https://github.com/kolotov/bellcom.git
cd bellcom
make run
For test you can try get info for meetings 1010, 1011
I used XMLHttpRequest for to get XML data and parse XML on client side
http://localhost:8080/index.html
Another way used jQuery (it also used XMLHttpRequest) for to get JSON data and parse XML on backend
http://localhost:8080/json_demo.html
MySQL http://localhost:8000/
SERVER db
LOGIN root
PASSWORD mysql
BD dump https://github.com/kolotov/bellcom/blob/main/config/init.sql