PHP Classes
elePHPant
Icontem

File: sample_opml.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Tom Schaefer  >  QXML  >  sample_opml.php  >  Download  
File: sample_opml.php
Role: Example script
Content type: text/plain
Description: Sample OPML Feed
Class: QXML
XML <> Array (preserve attrib.), JSON, etc.
Author: By
Last change:
Date: 6 years ago
Size: 1,933 bytes
 

Contents

Class file image Download
<?php
include("QXml.class.php");

$feeds = array(
       
"opml" => array(
           
"@attributes" => array("version" => 1.0),
           
"head" => array(
               
"title" => array("@textNode" =>"Feeds"),
               
"dateCreated" => array("@textNode" => date("Y-m-d H:M:S")),
               
"dateModified" => array("@textNode" => date("Y-m-d H:M:S")),
               
"ownerName" => array("@textNode" => "Me"),
               
"ownerEmail" => array("@textNode" => "my@example.com"),
               
"link" => array("@textNode" => "http://www.example.com"),
            ),
           
"body" => array(
               
"outline" => array(
                    array(
                       
"@attributes" => array("text" => "Tech News"),
                       
"outline" =>
                            array(
                                array(
                                   
"@attributes" => array(
                                   
"text" => "Mobile News",
                                   
"type"=>"link",
                                   
"url"=>"http://news4humans.com/feeds/mobile.xml",
                                   
"dateCreated"=>"Thu, 12 Sep 2003 23:35:52 GMT"),
                                ),
                                array(
                                   
"@attributes" => array(
                                   
"text" => "Syndication News",
                                   
"type"=>"link",
                                   
"url"=>"http://news4humans.com/feeds/mobile.xml",
                                   
"dateCreated"=>"Thu, 12 Sep 2003 23:35:52 GMT"),
                                ),
                            )
                        ),
                    array(
                       
"@attributes" => array("text" => "World News"),
                       
"outline" =>
                            array(
                                array(
                                   
"@attributes" => array(
                                   
"text" => "Politics",
                                   
"type"=>"link",
                                   
"url"=>"http://news4humans.com/feeds/mobile.xml",
                                   
"dateCreated"=>"Thu, 12 Sep 2003 23:35:52 GMT"),
                                ),
                                array(
                                   
"@attributes" => array(
                                   
"text" => "Sports",
                                   
"type"=>"link",
                                   
"url"=>"http://news4humans.com/feeds/mobile.xml",
                                   
"dateCreated"=>"Thu, 12 Sep 2003 23:35:52 GMT"),
                                ),
                            )
                        ),
                       
                ),
                   
            )
        )
    );
   
header("content-type:text/xml");
$xml = new QXML;
$xml->noCDATA();
$xml->toXML($feeds);
echo
$xml->asXML();

?>