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
https://forums.phpfreaks.com/topic/82939-problem-parsing-xml-in-php4/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.