Jump to content

tag name syntax


nickjonnes

Recommended Posts

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

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

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.