forked from marienfressinaud/lib_opml
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
61 lines (53 loc) · 1.04 KB
/
Copy pathindex.php
File metadata and controls
61 lines (53 loc) · 1.04 KB
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
55
56
57
58
59
60
61
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>lib_opml.php samples</title>
</head>
<body>
<?php
include('lib_opml.php');
echo '<h1>Test libopml_parse_file</h1>';
$filename = 'my_opml_file.xml';
try {
$opml_array1 = libopml_parse_file($filename);
echo '<pre>';
print_r($opml_array1);
echo '</pre>';
} catch (LibOPML_Exception $e) {
echo $e->getMessage();
}
echo '<h1>Test libopml_parse_string</h1>';
$opml_string = <<<XML
<?xml version="1.0" encoding="UTF-8" ?>
<opml version="2.0">
<head>
</head>
<body>
<outline text="A" />
<outline text="Simple" />
<outline text="OPML" />
<outline text="String" />
</body>
</opml>
XML;
try {
$opml_array2 = libopml_parse_string($opml_string);
echo '<pre>';
print_r($opml_array2);
echo '<pre>';
} catch (LibOPML_Exception $e) {
echo $e->getMessage();
}
echo '<h1>Test libopml_render</h1>';
try {
$opml_string = libopml_render($opml_array1);
echo '<pre>';
echo htmlentities($opml_string);
echo '<pre>';
} catch (LibOPML_Exception $e) {
echo $e->getMessage();
}
?>
</body>
</html>