Source for file magpie_debug.php

Documentation is available at magpie_debug.php

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

Documentation generated on Tue, 01 May 2007 16:44:46 +0200 by phpDocumentor 1.3.2