-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrssparser.php
More file actions
30 lines (26 loc) · 752 Bytes
/
rssparser.php
File metadata and controls
30 lines (26 loc) · 752 Bytes
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
<?php
$html = "";
$url = $_POST['url'];
$xml = simplexml_load_file($url);
echo "<html><form action = 'searchbar.php' method = 'POST'><input type = 'submit' value = 'Search again'></form></html>";
for($i = 0;$i < 10;$i++)
{
$title = $xml->channel->item[$i]->title;
$link = $xml->channel->item[$i]->link;
$desc = $xml->channel->item[$i]->description;
$html = "<!DOCTYPE html>
<html>
<head>
<title>Results</title>
</head>
<body>
<div>
<h2>$title</h2>
<h3><p>$desc</p></h3><br>
<a href='$link' target='_blank'>$link</a>
</div>
</body>
</html>";
echo $html;
}
?>