To get RSS content, you can use this script.
<?php
$domOBJ = new DOMDocument();
$domOBJ->load("https://www.thailand.go.th/useful-rss");//XML page URL
$content = $domOBJ- >getElementsByTagName("item");
foreach( $content as $data )
{
$title = $data->getElementsByTagName("title")->item(0)->nodeValue;
$link = $data->getElementsByTagName("link")->item(0)->nodeValue;
echo "$title :: $link";
}
?>
using ReadRSSFeed.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using System.Xml.Linq;
namespace ReadRSSFeed.Controllers
{
public class RSSFeedController : Controller
{
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult Index(string RSSURL)
{
WebClient wclient = new WebClient();
string RSSData=wclient.DownloadString(RSSURL);
XDocument xml = XDocument.Parse(RSSData);
var RSSFeedData = (from x in xml.Descendants("item")
select new RSSFeed
{
Title = ((string)x.Element("title")),
Link = ((string)x.Element("link")),
Description = ((string)x.Element("description")),
PubDate = ((string)x.Element("pubDate"))
});
ViewBag.RSSFeed = RSSFeedData;
ViewBag.URL = RSSURL;
return View();
}
}
}
import feedparser
NewsFeed = feedparser.parse("https://www.thailand.go.th/useful-rss")
entry = NewsFeed.entries[1]
print entry.published
print "******"
print entry.summary
print "------News Link--------"
print entry.link