PHP Classes

File: sample_atom.php

Recommend this page to a friend!
  Classes of Tom Schaefer   QXML   sample_atom.php   Download  
File: sample_atom.php
Role: Example script
Content type: text/plain
Description: Sample Atom Feed
Class: QXML
XML <> Array (preserve attrib.), JSON, etc.
Author: By
Last change: - adding header content-type
Date: 16 years ago
Size: 1,183 bytes
 

Contents

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

$feeds = array(
       
"feed" => array(
           
"@attributes" => array("xmlns" => "http://www.w3.org/2005/Atom"),
           
"author" => array(
               
"name" => array(
                   
"@textNode" => array("Thomas Schaefer")
                ),
           
"id" => array("@textNode" => array("urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6"))
            ),
           
"entry" =>
            array(
                array(
               
"title" => array("@textNode" => "Your RSS Feed Title"),
               
"link" => array("@attributes"=>"your-link-to-the-feed"),
               
"summary" => array("@textNode" => "Short description of the feed"),
               
"updated" => array("@textNode" => date("Y-m-d H:M:S")),
               
"content" => array("@textNode" => "Your Content Here..."),
                ),
                array(
               
"title" => array("@textNode" => "Your RSS Feed Title"),
               
"link" => array("@attributes"=>"your-link-to-the-feed"),
               
"summary" => array("@textNode" => "Short description of the feed"),
               
"updated" => array("@textNode" => date("Y-m-d H:M:S")),
               
"content" => array("@textNode" => "Your Content Here..."),
                ),
            ),
        )
);

header("content-type:text/xml");
$xml = new QXML;
$xml->noCDATA();
$xml->toXML($feeds);
echo
$xml->asXML();

?>