RSS Parsing
- On line 33, we create our own function called 'getFeed', which we can pass an RSS URL to.
- On line 35, we get and store the entire file contents at the URL we passed to our function.
- On line 36, we pass the stored file to PHP's own function, SimpleXmlElement(), this turns the file contents into an object we can manipulate.
- On line 39, we run a loop through the SimpleXmlElement object of our file, grabbing the text between each XML tag we want.
- We echo (in this case, print to document) the contents of the TITLE between 'h2' tags,
- the contents of LINK between 'a' tags,
- and the contents of DESCRIPTION between 'p' tags.
- The loop is told to break when it has done four iterations!
![]() |
| RSS Parser |

No comments:
Post a Comment