lv211
Jan 1st 2008, 1:11 pm
I'm using Zend - Gbase and I'm trying to get at the link data through a snippets query.
I can access the other information but I can't seem to get to the data I want.
Here is an example of the xml data I'm trying to parse.
http://www.google.com/base/feeds/snippets/13193570405856859506
Here is the code. It works for the title and image tags. When I try to get the link data I end up with an array. I've tried numerous ways to break it down but I can't seem to get at the real data.
Any help or insight is appreciated.
<html>
<head>
<title></title>
</head>
<body>
<?php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_Gbase');
$service = new Zend_Gdata_Gbase();
$query = $service->newSnippetQuery();
$query->setBq('[title:Chateau Latour]');
$query->setOrderBy('modification_time');
$query->setSortOrder('descending');
$query->setCategory('Wine');
$query->setMaxResults('10');
$feed = $service->getGbaseSnippetFeed($query);
foreach ($feed->entries as $entry) {
echo 'Title: ' . $entry->title->text . "<br>\n";
// using the defined accessors
$image = $entry->getGbaseAttribute("image_link");
foreach ($image as $img) {
echo "Image " . '<img src="' . $img->text . '">' . "<br>\n";
}
echo "<br><br>\n";
}
?>
</body>
</html>
I can access the other information but I can't seem to get to the data I want.
Here is an example of the xml data I'm trying to parse.
http://www.google.com/base/feeds/snippets/13193570405856859506
Here is the code. It works for the title and image tags. When I try to get the link data I end up with an array. I've tried numerous ways to break it down but I can't seem to get at the real data.
Any help or insight is appreciated.
<html>
<head>
<title></title>
</head>
<body>
<?php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_Gbase');
$service = new Zend_Gdata_Gbase();
$query = $service->newSnippetQuery();
$query->setBq('[title:Chateau Latour]');
$query->setOrderBy('modification_time');
$query->setSortOrder('descending');
$query->setCategory('Wine');
$query->setMaxResults('10');
$feed = $service->getGbaseSnippetFeed($query);
foreach ($feed->entries as $entry) {
echo 'Title: ' . $entry->title->text . "<br>\n";
// using the defined accessors
$image = $entry->getGbaseAttribute("image_link");
foreach ($image as $img) {
echo "Image " . '<img src="' . $img->text . '">' . "<br>\n";
}
echo "<br><br>\n";
}
?>
</body>
</html>