-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
54 lines (46 loc) · 1.27 KB
/
index.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
53
54
<?php
spl_autoload_register();
use App\Parser;
use App\ParserWithoutGenerators;
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$source = [];
echo '<br /><a href="/">Home</a>';
if ($_POST['select'] == 'with') {
$data = new Parser($_POST['url']);
foreach ($data->parse() as $item) {
$source[] = $item;
}
}
if ($_POST['select'] == 'without') {
$data = new ParserWithoutGenerators($_POST['url']);
$source = $data->parse();
}
echo '<pre>';
echo print_r($source, true);
echo '</pre>';
echo 'Memory size was used for this script: ' . memory_get_usage() . ' Bytes';
echo '<br /><a href="/">Home</a>';
exit;
}
?>
<!DOCTYPE html>
<html lang="ru">
<head>
<title></title>
<meta charset="utf-8">
</head>
<body>
<form method='post'>
Enter the RSS URL:<br/>
<input type="text" name="url" value="https://rss.dw.com/xml/rss_en_science" size="70"/>
<br/>
<br/>Choose the method: <br/>
<select name="select">
<option value="with">With generators</option>
<option value="without">Without generators</option>
</select>
<input type='submit' value='Send'/>
</form>
<?= '<br />Memory size was used for this script: ' . memory_get_usage() . ' Bytes'; ?>
</body>
</html>