Trouble reading XML/RSS files, any help appreciated! |
[eluser]jonhurlock[/eluser]
Ive created a function which gets the latest news from different sites XML/RSS feeds, in this case i've done an example using a Twitter RSS feed, for a twitter search query, it then displays the results from the RSS feed on my site. Basically i randomly keep on getting errors which looks like the following: Quote:A PHP Error was encounteredWhen the errors render the line number which is in red (10) keeps on changing. On one load of the page i had several of the same messages but where it displays for lines 10,11,12,13,13,13,13 (I dont understand why it rendered 13 4 times?) The line 103 refers to the line Code: $xmlDoc->load($xml); Is this because the XML did not comply to specifications/is broken or is there something wrong with my code? Because some times the page appears to be fine with no errors, and then every once in a while i get spammed with errors Any help would be much appreciated. Eventually i would like to cache the results so my users aren't sending off to many requests to feeds original source Function from my Controller: Code: function output_from_feed(){
[eluser]tomcode[/eluser]
To avoid getting errors : Code: try Check on parsing errors. Check the presence of the nodes You use.
[eluser]jonhurlock[/eluser]
Try Catch Blocks makes, sense cheers for the suggestion. I'm sure that should sort it out. Thanks for the hand. |
Welcome Guest, Not a member yet? Register Sign In |