Je ne sais pas quel langage de programmation vous utilisez mais je peux partager un extrait de code développé en C#. Il obtient le contenu rss d'un blog WordPress, analyse ce contenu, et affiche 3 meilleurs liens de blog.
int blogitemcount = 3;
string wordpressBlog = "wordpress blog address";
System.Net.WebClient wc = new System.Net.WebClient();
byte[] buffer = wc.DownloadData("http://" + wordpressBlog + "/feed/rss");
wc.Dispose();
wc = null;
if(buffer.Length > 0) {
string content = Encoding.UTF8.GetString(buffer);
XmlDocument xdoc = new XmlDocument();
xdoc.LoadXml(content);
XmlNodeList nodes=xdoc.SelectNodes("/rss/channel/item");
string linkformat = "<a href='{0}' target='_blank' class='blogitem'>{1}</a>";
for(int i=0; i < nodes.Count && i < blogitemcount;i++)
{
XmlNode n = nodes[i];
this.ltItems.Text += string.Format(linkformat, n.SelectSingleNode("link").InnerText, n.SelectSingleNode("title").InnerText);
}
}
Merci. J'utilise objective-c pour ios. – Moshe