-
Notifications
You must be signed in to change notification settings - Fork 0
/
request.php
52 lines (46 loc) · 2.17 KB
/
request.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
// accept a term (keyword)
// respond with a value
$query = $_GET['q'];
// $definition = [
// "definition" => "A statement of the exact meaning of a word, especially in a dictionary.",
// "bar" => "A place that sells alcholic beverages",
// "ajax" => "Technique which involves the use of javascript and xml (or JSON)",
// "html" => "The standard markup language for creating web pages and web applications.",
// "css" => "A style sheet language used for describing the presentation of a document written in a markup language.",
// "javascript" => "A lightweight, interpreted programming language with first-class functions that adds interactivity to your website.",
// "php" => "A server-side scripting language, and a powerful tool for making dynamic and interactive websites",
// ];
// print "<h3>" . strtoupper($query) . "</h3>";
// print "<p>" . $definition[$query] . "</p>";
$xmlData = '<?xml version="1.0" encoding="UTF-8"?>
<entries>
<definition name="definition" author="John">
a statement of the exact meaning of a word, especially in a dictionary.
</definition>
<definition name="bar" author="mary">
a place that sells alcholic beverages.
</definition>
<definition name="ajax" author="Kimberly">
technique which involves the use of javascript and xml.
</definition>
<definition name="html" author="Bob">
The standard markup language for creating web pages and web applications.
</definition>
<definition name ="css" author="Jim">
A style sheet language used for describing the presentation of a document written in a markup language.
</definition>
<definition name="javascript" author="Yannick LynFatt">
A lightweight, interpreted programming language with first-class functions that adds interactivity to your website.
</definition>
<definition name="php" author=" Trevor Munroe">
A server-side scripting language, and a powerful tool for making dynamic and interactive websites
</definition>
< entries>
';
header('Content-Type: text/xml');
$xmlDataGo= new SimpleXMLElement(xmlData);
echo $trueXml = asXML();
print "<h2>" . strtoupper($query) . "</h2>";
print "<p>" . $xmlData[$query] . "</p>";
print "<p> -" .$xmlData[$query]. "</p>";