Php will use rss format into json

    Php should be converted into rss json, the conversion idea is simple:
rss -> php array -> json

We do not have to carry out such work from scratch, pear has already provided some of the available class libraries, to use the command line below pear install these packages
pear install channel: / / pear.php.net/XML_RSS-0.9.9
pear install channel: / / pear.php.net/HTML_AJAX-0.4.0

Below is a simple test code:
PLAIN TEXT
PHP:

    1.
       <? php
    2.
       require_once 'XML / RSS.php';
    3.
       require 'HTML / AJAX / JSON.PHP';
    4.
      
    5.
       $ rss = new XML_RSS ( 'http://www.ooso.net/index.php/feed/');
    6.
       $ rss-> parse ();
    7.
       / / var_dump ($ rss-> getItems ());
    8.
      
    9.
       $ json = new HTML_AJAX_JSON ();
   10.
       $ js = $ json-> encode ($ rss-> getItems ());
   11.
      
   12.
       echo $ js;
   13.
       «>

Leave a Reply

Copyright © 2007 - Antivirus—Kaspersky key|kav7.0 key|kis7.0 key|kav8.0 key|kis8.0 key

  • Partner links