Jump to content

Problem parsing XML in PHP4


Popple3

Recommended Posts

I can get the information from tags, however there are two tags in the XML (that I have no control over) called media:group and media:thumbnail. When entered (as in the code below), i get an "unexpected ':'" parse error. I'm looking for a simple solution. I'm not very familiar with PHP, so examples would be helpful. Thanks in advace

 

<?php
include('xmlparser.php');
//Get the XML document loaded into a variable
$xml = file_get_contents('http://picasaweb.google.com/data/feed/api/user/popple3?kind=album');
//Set up the parser object
$parser = new XMLParser($xml);

//Work the magic...
$parser->Parse();

//Echo the title and image of each <entry>
foreach($parser->document->entry as $entry)
{
    $imgurl = $entry->media:group->media:thumbnail->tagAttrs['url'];
    echo $entry->title[0]->tagData;
    echo "<img src=\"" . $imgurl . "\">";
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.