imdbXML

The imdbXML class can be used to convert an imdb object to XML: All object attributes will be converted to XML tags, including their values. Since the class extends PEARs XML_Serializer class, you will need to have PEAR installed for this.

The following code gives you an example of how to use the class. Saved to a file and called, it will return XML with title, year and plotoutline tags:

<?php
require_once("imdbXML.php");

$imdb = new imdb($_REQUEST['id']);
$imdb->title();
$imdb->year();
$imdb->plotoutline();

$obj = new imdbXML($imdb);
$xml = $obj->getSerializedData();

header ("content-type: text/xml");
header("Content-Length: ".strlen($xml)); 
echo $xml;
?>
Last modified by izzy, 02/25/09 16:42:22 (17 months ago)