开发者

Extract content from RSS feed into php file

开发者 https://www.devze.com 2023-04-01 02:29 出处:网络
I am sorry if this seems like a stupid question but I am a newbie in this field and any help would be really appreciated. So here\'s the question- Suppose if I have a RSS feed of a particular site and

I am sorry if this seems like a stupid question but I am a newbie in this field and any help would be really appreciated. So here's the question- Suppose if I have a RSS feed of a particular site and I 开发者_开发知识库want to extract its content and store it in a PHP script, how would I do it? I want to define particular names like $title, $tag, $date etc and save the extracted content into my database and use it from there. Currently, I am using http://dapper.com for this purpose but it is too slow and inaccurate, so I want to do it manually. If you could suggest me a way of doing this or direct me to some links online, it would be of great help. Thank you.


An rss feed is an xml file. Use simplexml: http://us.php.net/simplexml. Here's a blog post showing just how easy it is, and throws in a quick curl example to show how to fetch the actual feed data: http://return-true.com/2010/04/parsing-a-rss-feed-with-php-using-simplexml/


There are many PHP classes written specifically for RSS parsing.

You might want to try magpierss.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号