2

I wish to parse the RSS feed in PHP. I first found various third party libraries to do the same namely: Magpie and simplepie.

But since RSS files are in XML format, PHP also has native functions of simplexml_load_file to parse a XML file.

So why should one required the external libraries and not use the native function?

Bhumi Singhal
  • 8,063
  • 10
  • 50
  • 76
  • 1
    You can use the native functions, nobody forces you to use 3rd-party libraries; but typically 3rd-party libraries have been written to simplify certain tasks, saving you the effort of writing that code yourself; or perhaps written by people who have a better understanding of RSS than yourself, and who may have coded handling for situations (e.g. badly formed XML, etc) that you might not know about or forget if coding youself – Mark Baker Aug 13 '13 at 08:09
  • 1
    At the very least, using a 3rd-party library can save you time and effort – Mark Baker Aug 13 '13 at 08:12

2 Answers2

4

Using a third party lib which specialized in reading RSS feeds, you will have some methods and properties that SimpleXML has not, because there are implemented into this library.

But if you want to read a simple XML feed, using SimpleXML could be sufficient.

Magpie for example implemented some functions to cache data, for example.

netvision73
  • 4,831
  • 1
  • 24
  • 30
2

"RSS" is a name for four different formats, and there is also Atom that should be supported.

Using a library means you get support for all those formats at once, while you have to implement support for each one separately when doing it manually.

cweiske
  • 30,033
  • 14
  • 133
  • 194