Gaia Posted January 22, 2009 Share Posted January 22, 2009 Hi, I'm trying to extract data from an Atom feed using PHP. I can get the title and published/updated date, but am having a hard time figuring out the path to the link="href" section of the Atom feed. I have $xml->entry->link, but when I try to go any further it results in an empty result. How do I finish the query to extract the link data? Here is a print_r of $xml->entry->link SimpleXMLElement Object ( [@attributes] => Array ( [href] => /p/doulx ) ) I've never tried to extract data from an Atom feed before and am finding it difficult. Any tips would be great. thanks. Quote Link to comment https://forums.phpfreaks.com/topic/141873-solved-extracting-atom-feed-with-php/ Share on other sites More sharing options...
chronister Posted January 22, 2009 Share Posted January 22, 2009 What do you get when you try the following option? <?php echo $xml->entry->link[0]->@attributes->href; ?> If that does not work, post a link to the atom feed your trying to extract from so we can see the whole thing. Nate Quote Link to comment https://forums.phpfreaks.com/topic/141873-solved-extracting-atom-feed-with-php/#findComment-742977 Share on other sites More sharing options...
Mchl Posted January 22, 2009 Share Posted January 22, 2009 SimpleXMLElement->attributes Quote Link to comment https://forums.phpfreaks.com/topic/141873-solved-extracting-atom-feed-with-php/#findComment-743052 Share on other sites More sharing options...
Gaia Posted January 22, 2009 Author Share Posted January 22, 2009 SimpleXMLElement->attributes I'm a noob. I searched everywhere but the PHP docs . Thanks for the link, worked like a charm. Quote Link to comment https://forums.phpfreaks.com/topic/141873-solved-extracting-atom-feed-with-php/#findComment-743381 Share on other sites More sharing options...
Dethman Posted January 23, 2009 Share Posted January 23, 2009 You can actually extract atoms using PHP o.O Quote Link to comment https://forums.phpfreaks.com/topic/141873-solved-extracting-atom-feed-with-php/#findComment-743850 Share on other sites More sharing options...
Gaia Posted January 23, 2009 Author Share Posted January 23, 2009 You can actually extract atoms using PHP o.O But of course. Quote Link to comment https://forums.phpfreaks.com/topic/141873-solved-extracting-atom-feed-with-php/#findComment-743854 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.