nickjonnes Posted May 31, 2011 Share Posted May 31, 2011 hey all, here is the xml code <title>Dogged determination</title> <link rel="alternate" href="http://video.news.com.au/1959670201/Dogged-determination" /> <author> <name>mr mittens</name> </author> now to parse this to get the title i would do this but what if i want the link? <?php$feed = simplexml_load_file('http://video.news.com.au/feed.atom');$link = (string) $feed->entry->title;echo $link;?> but what do i do to get the 'link'? i tried link an that obviously didnt work. cheers nick Link to comment https://forums.phpfreaks.com/topic/237972-tag-name-syntax/ Share on other sites More sharing options...
acefirefighter Posted May 31, 2011 Share Posted May 31, 2011 I was looking for my two day old post with no replies and I found yours so here is my 2 cents. I am not 100% sure and I may be way off base but it seems to work in my head and my syntax for preg_match may not be right on either. I don't use reg-ex that often. <?php $feed = simplexml_load_file('http://video.news.com.au/feed.atom'); $pattern = '/href="(.)*"/'; $link = preg_match($pattern, $feed->entry->link); echo $link; ?> Link to comment https://forums.phpfreaks.com/topic/237972-tag-name-syntax/#findComment-1223081 Share on other sites More sharing options...
xyph Posted May 31, 2011 Share Posted May 31, 2011 <?php $xml = simplexml_load_file('http://video.news.com.au/feed.atom'); foreach( $xml->entry as $entry ) { echo "Title - {$entry->title}<br>"; echo "Link - {$entry->link->attributes()->href}<br>"; echo "Summary - {$entry->summary}<br><br>"; } ?> Link to comment https://forums.phpfreaks.com/topic/237972-tag-name-syntax/#findComment-1223097 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.