PHP / XML Problem

This is a discussion on "PHP / XML Problem" within the PHP Forum section. This forum, and the thread "PHP / XML Problem are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Mar 5th, 2007, 17:02
Reputable Member
Join Date: Oct 2006
Location: UK
Age: 25
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
PHP / XML Problem

I am trying to use the XSPF music player from http://musicplayer.sourceforge.net/ , it works fine when i create a standard xspf playlist in the format prescribed at http://www.xspf.org/ . I have a sample located here www.wirralweb.me.uk/demo.xspf which contains:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<playlist version="0" xmlns="http://xspf.org/ns/0/">
    <trackList>
        <track>
        <location>http://www.wirralweb.me.uk/mp3s/boag2.mp3</location>
            <creator>dfsdfsdfsdf</creator>
            <album>dfsf</album>
            <title>fsdfsdf</title>
            <annotation>poo</annotation>
        </track>
    </trackList>
</playlist>
However i want this list to be generated from a directory /mp3s using the getid3 classes.

I have the PHP script at www.wirralweb.me.uk/demo.php and it contains:
Code: Select all
<?php
header("Content type: application/xspf+xml");
echo '<?xml version="1.0" encoding="UTF-8"?>
<playlist version="0" xmlns="http://xspf.org/ns/0/">
    <trackList>';
    include("funcs.php");
createplaylist();
echo '
    </trackList>
</playlist>';
?>
and... funcs.php contains:
Code: Select all
<?php
function createplaylist() {
    require_once('getid3/getid3.php');

    // Initialize getID3 engine
    $getID3 = new getID3;

    $DirectoryToScan = $_SERVER['DOCUMENT_ROOT']."/mp3s"; // change to whatever directory you want to scan
    $dir = opendir($DirectoryToScan);
    while (($file = readdir($dir)) !== false) {
        $FullFileName = realpath($DirectoryToScan.'/'.$file);
        if (is_file($FullFileName)) {
            set_time_limit(30);

            $ThisFileInfo = $getID3->analyze($FullFileName);

            getid3_lib::CopyTagsToComments($ThisFileInfo);

            // output desired information in whatever format you want


            $location = "http://www.wirralweb.me.uk/".$file;
            $title = $ThisFileInfo['comments_html']['title'][0];
            $artist = $ThisFileInfo['comments_html']['artist'][0];
            $album = $ThisFileInfo['comments_html']['album'][0];
            echo "
            <track>
            <location>$location</location>
                <creator>$artist</creator>
                <album>$album</album>
                <title>$title</title>
                <annotation>poo</annotation>
            </track>";
        }
}
}
?>
it generates the EXACT same code as demo.xspf however the player does not use the data, any comments on my code or reasons why you think this may not be working would be much appreciated.

music players located at www.wirralweb.me.uk/music.php - php script
and www.wirralweb.me.uk/music1.php - static xspf file

many thanks in advance
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Mar 6th, 2007, 13:52
Reputable Member
Join Date: Oct 2006
Location: UK
Age: 25
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP / XML Problem

NOTE:

Now working, I had refrenced the file wrongly in the html.

Oops
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
php, xml, xspf

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
First image problem and inline list problem konnor5092 Web Page Design 8 Dec 1st, 2007 10:08


All times are GMT. The time now is 13:20.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved