html - Parse XML link with PHP -
i have xml feed looks this:
i can parse title enough using simplexml:
$pictureboxxmlfeed = simplexml_load_file('https://www.picturebox.tv/xml/feeds/findanyfilm/findanyfilm.xml');; echo $pictureboxxmlfeed->entry[1]->title; foreach($pictureboxxmlfeed->entry $value){ echo $value->title; echo '<br/>'; }
but need grab link element in feed looks this:
<link href="http://www.picturebox.tv/watchnow?id=ukic30" rel="alternate"/>
fyi, doesn't work:
echo $value->link;
thanks help...
is mean?
$string = ' <entry> <link href="http://www.picturebox.tv/watchnow?id=ukic30" rel="alternate"/> </entry>'; $simplexml = simplexml_load_string($string); foreach($simplexml->link->attributes() $name => $value) { echo $name.': '.$value.'<br />'; }
gives:
href: http://www.picturebox.tv/watchnow?id=ukic30 rel: alternate
Comments
Post a Comment