How to read <content:encoded> from RSS feed
for example, from this link ?
http://www.zurnal.rs/category/rukomet/feed?lang=lat
Read <content:encoded> from RSS feed
-
- Posts: 28
- Joined: Wed Jun 08, 2011 10:31 am
Re: Read <content:encoded> from RSS feed
$encoded = $item->content; - not working (empty string is resolt)jacek wrote:Does the simpleXML extension not recognise it ?
$encoded = $item->encoded; - not working (empty string is resolt)
$encoded = $item->content:encoded; - not working (error)
Re: Read <content:encoded> from RSS feed
It may rename it to somethign for compatibility. Try doing
print_r($item);and see if you can see the value anywhere ?
-
- Posts: 28
- Joined: Wed Jun 08, 2011 10:31 am
Re: Read <content:encoded> from RSS feed
No, condtent:encoded part, do not whow up on screen?jacek wrote:It may rename it to somethign for compatibility. Try doing
print_r($item);and see if you can see the value anywhere ?
Can you help of andrsthend this example:
<?php $rss = new SimpleXMLElement('http://www.naslovi.net/rss/sport/', null, true); $ns = $rss->getNamespaces(true); ?><h1><a href='<?php echo $rss->channel->link; ?>'><?php echo $rss->channel->title; ?></a></h1> <?php echo PHP_EOL?><hr /><?php echo PHP_EOL; $sql = "INSERT INTO `rss_vesti` VALUES"; foreach($rss->xpath('channel/item') as $item) { preg_match('/<img[^>]+>/', $item->children($ns['content'])->encoded, $match); $item->image = $match[0]; $naslov = $item->title; $link = $item->link; $slika = $item->image; $opis = $item->description; $datum = $item->pubDate; $sql.="('','','".$naslov."','".$slika."','".$opis."','".$link."','".$datum."'),"; } //KRAJ PETLJE - INSERT upit $sql = substr($sql,0,-1).";"; $result = mysql_query($sql,$konekcija); ?>
Re: Read <content:encoded> from RSS feed
But did the value of that element ?hostingebc wrote:No, condtent:encoded part, do not whow up on screen?
Looks like it is getting some information from an RSS feed and putting it into a database.hostingebc wrote:Can you help of andrsthend this example:
also, please use the php button when posting code, not quotes.
-
- Posts: 28
- Joined: Wed Jun 08, 2011 10:31 am
Re: Read <content:encoded> from RSS feed
nojacek wrote: But did the value of that element ?
yes i know that, but what is diference betwen my and this example (in my examle i have somtime problem with 30 second of execution of php code)jacek wrote: Looks like it is getting some information from an RSS feed and putting it into a database.
what is quicker ? (if you know)
what is better to use?
Re: Read <content:encoded> from RSS feed
Then I guess you will have to match it with a regular expressionhostingebc wrote:no
Or try this more simple approach http://ja.meswilson.com/blog/2007/05/19 ... s-simpler/
I have only seen one examplehostingebc wrote:what is quicker ? (if you know)
what is better to use?