tags:

views:

35

answers:

1

Trying to just retrieve blog post and print the contents to a site. I am using the printFeed method from the documentation but it just seems to print the title. I need the title,body,photos,comments,etc.

function printFeed($feed)
{
    $i = 0;
    foreach($feed->entries as $entry) {
        print $i ." ". $entry->title->text . "\n";
        $i++;
    }
}

I used print_r() on the array put it was just a mess of variables. I can't find any information on this. I also use the query function to limit my data and that throws errors. Anyone got any ideas?

+1  A: 

For testing, you should be able to use the toArray() function

print_r($entry->toArray());

This should show you the variables. You can access them in the object format similar to what you used for the title:

echo $entry->body;

Hopefully this helps. You will need to add the other items as well that you wish to print. The toArray() method above is meant as an illustration, but if it is easier for you to understand how to work an array, you can assign that to a variable, but the object should work just as well.

EDIT

I was mistaken about the toArray() call. Either or, does the $entry->body or $entry->body->text get you that information you need?

Brad F Jacobs
toArray() throws an exception. "toArray not found in Gdata Libraries ......"
kbrin80
Plantation BuildingFatal error: Uncaught exception 'Zend_Gdata_App_InvalidArgumentException' with message 'Property body does not exist' in /home/plant/public_html/includes/classes/Zend/Gdata/App/Base.php:484 Stack trace: #0 /home/plant/public_html/skin/plantation-building.php(25): Zend_Gdata_App_Base->__get('body') #1 /home/plant/public_html/index.php(236): include('/home/plant/pub...') #2 {main} thrown in /home/plant/public_html/includes/classes/Zend/Gdata/App/Base.php on line 484
kbrin80