I'm parsing a RSS feed to get the raw data and manipulate it.
On a WordPress RSS feed. I can find the title, link, description and publication of a the post by iterating over the SimpleXMLElement. The nodes are located in:
$title = $xml->channel->item[$i]->title; $link = $xml->channel->item[$i]->link; $description = $xml->channel->item[$i]->description; $pubDate = $xml->channel->item[$i]->pubDate; respectively.
The problem is $description had 2 <p>s inside. One one which is useless for me; the second one.
So how do I assign $description to only the first <p> of description?
Getting simply $xml->channel->item[$i]->description->p[0] won't work. It results in an internal server error.
No comments:
Post a Comment