How do I get the actual title and description from an RSS feed with PHP

1 replies
I'm referring to the actual title and description of the feed itself not the titles and descriptions in the items.

Thanks,
Rick
#actual #description #feed #php #rss #title
  • Profile picture of the author MelissaCollin
    To get the title and description of an RSS feed with PHP, you can use the SimpleXMLElement class to parse the XML data. Here's an example:
    $url = '<http://example.com/feed.xml>';
    $xml = simplexml_load_file($url);

    $title = $xml->channel->title;
    $description = $xml->channel->description;

    This code loads the RSS feed from the URL, and then extracts the title and description from the <channel> element.
    Note that the code assumes that the RSS feed has a <channel> element, which is the case for most RSS feeds. If the feed you're working with has a different structure, you may need to adjust the code accordingly.
    {{ DiscussionBoard.errors[11753391].message }}

Trending Topics