source: Dev/trunk/rdfapi/util/magpie/scripts/magpie_debug.php @ 12

Last change on this file since 12 was 12, checked in by basvannuland, 14 years ago

Added RAP RDF API
Added RDF reader writer for save and load survey

File size: 1.9 KB
Line 
1<?php
2
3ini_set('display_errors', 1);
4ini_set('error_reporting', E_ALL);
5define('MAGPIE_OUTPUT_ENCODING', 'UTF-8');
6define('MAGPIE_DIR', '../');
7define('MAGPIE_DEBUG', 1);
8
9// flush cache quickly for debugging purposes, don't do this on a live site
10define('MAGPIE_CACHE_AGE', 10);
11
12require_once(MAGPIE_DIR.'rss_fetch.inc');
13
14
15if ( isset($_GET['url']) ) {
16        $url = $_GET['url'];
17}
18else {
19        $url = 'http://magpierss.sf.net/test.rss';
20}
21
22
23test_library_support();
24
25$rss = fetch_rss( $url );
26       
27if ($rss) {
28        echo "<h3>Example Output</h3>";
29        echo "Channel: " . $rss->channel['title'] . "<p>";
30        echo "<ul>";
31        foreach ($rss->items as $item) {
32                $href = $item['link'];
33                $title = $item['title'];       
34                echo "<li><a href=$href>$title</a></li>";
35        }
36        echo "</ul>";
37}
38else {
39        echo "Error: " . magpie_error();
40}
41?>
42
43<form>
44        RSS URL: <input type="text" size="30" name="url" value="<?php echo $url ?>"><br />
45        <input type="submit" value="Parse RSS">
46</form>
47
48<h3>Parsed Results (var_dump'ed)</h3>
49<pre>
50<?php var_dump($rss); ?>
51</pre>
52
53<?php
54
55function test_library_support() {
56   if (!function_exists('xml_parser_create')) {
57           echo "<b>Error:</b> PHP compiled without XML support (--with-xml), Mapgie won't work without PHP support for XML.<br />\n";
58           exit;
59   }
60   else {
61           echo "<b>OK:</b> Found an XML parser. <br />\n";
62   }
63   
64   if ( ! function_exists('gzinflate') ) {
65           echo "<b>Warning:</b>  PHP compiled without Zlib support (--with-zlib). No support for GZIP encoding.<br />\n";
66   }
67   else {
68           echo "<b>OK:</b>  Support for GZIP encoding.<br />\n";
69   }
70   
71   if ( ! (function_exists('iconv') and function_exists('mb_convert_encoding') ) ) {
72           echo "<b>Warning:</b>  No support for iconv (--with-iconv) or multi-byte strings (--enable-mbstring)." . 
73                   "No support character set munging.<br />\n";
74   }
75   else {
76           echo "<b>OK:</b>  Support for character munging.<br />\n";
77   }
78}
79
80?>
Note: See TracBrowser for help on using the repository browser.