Write a complete PHP web service Ama2000.php that processes the data containing the names of the babies which are born early 2000’s. The PHP service reports the best (lowest) popularity ranking that name has ever held in the South African Home Affairs database. Create a service which accepts a GET request parameter called name with the following cases: • Its output is a single line of plain text containing the best ranking number, or -1 if no name parameter is passed or if the name is not found in the file. • The input file to read, ama2000.txt, is in the below format, with each line containing a baby's first name followed by some number of popularity rankings. The sample data below has 11 rankings per line, but for full credit your code should work regardless of how many rankings (1 or more) are on each line assigned to a name. Bontle 31 25 24 26 30 46 93 163 209 289 382 Bonang 66 79 84 94 93 78 70 108 127 142 177 Bohlale 631 752 712 664 720 933 636 752 680 856 918 Martha 44 55 16 66 898 977 98 567 38 89 90 128 678 890 Martin 69 58 34 68 45 76 28 78 98 90 78 87 84 83 85 97 Mart 55 88 09 87 54 56 78 65 78 65 76 34 76 89 ...... For example, if your service were requested as Ama2000.php?name=Bontle, its output would be 24, since that is Martha’s best popularity ranking. • If the request is Ama2000.php?name=Bonolo, its output would be -1 since that name is not in the file. • If the request is Ama2000.php?name= 66, its output would be -1 since that name is not in the file. • If the request is Ama2000.php?name= B, its output would be -1 since that name is not in the file. • Assume John is the file has ranking of 88 16 34 16 590 67 265 987 657 87 545, If the request is Ama2000.php?name= John, its output would be 16 since the ranking 16 appears twice in the file. Ensure that your code matches case-insensitively; for example, the request Ama2000.php?name=BoHLalE should match the
Write a complete PHP web service Ama2000.php that processes the data containing the
names of the babies which are born early 2000’s. The PHP service reports the best (lowest)
popularity ranking that name has ever held in the South African Home Affairs
Create a service which accepts a GET request parameter called name with the following
cases:
• Its output is a single line of plain text containing the best ranking number, or -1 if no
name parameter is passed or if the name is not found in the file.
• The input file to read, ama2000.txt, is in the below format, with each line containing a
baby's first name followed by some number of popularity rankings.
The sample data below has 11 rankings per line, but for full credit your code should work
regardless of how many rankings (1 or more) are on each line assigned to a name.
Bontle 31 25 24 26 30 46 93 163 209 289 382
Bonang 66 79 84 94 93 78 70 108 127 142 177
Bohlale 631 752 712 664 720 933 636 752 680 856 918
Martha 44 55 16 66 898 977 98 567 38 89 90 128 678 890
Martin 69 58 34 68 45 76 28 78 98 90 78 87 84 83 85 97
Mart 55 88 09 87 54 56 78 65 78 65 76 34 76 89
......
For example, if your service were requested as Ama2000.php?name=Bontle, its output
would be 24, since that is Martha’s best popularity ranking.
• If the request is Ama2000.php?name=Bonolo, its output would be -1 since that name
is not in the file.
• If the request is Ama2000.php?name= 66, its output would be -1 since that name is
not in the file.
• If the request is Ama2000.php?name= B, its output would be -1 since that name is
not in the file.
• Assume John is the file has ranking of 88 16 34 16 590 67 265 987 657 87 545, If the
request is Ama2000.php?name= John, its output would be 16 since the ranking 16
appears twice in the file.
Ensure that your code matches case-insensitively; for example, the request
Ama2000.php?name=BoHLalE should match the name Bohlale in the data file.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images