I have a script that generates an XML file for RSS. I know I can copy and paste the URL to the XML file into an RSS Validator by hand. Is there a PHP script or function out there that can validate an RSS file and return a boolean variable to indicate if it is valid or not?

Ideally what I'd like happen is have my script automatically create the file, validate the XML and send an e-mail to me if there is a problem for some reason.

Rob

    You could always use [man]cURL[/man] to post the generated XML to the RSS validator and then read the result(s). And depending upon what the "valid" output should be on the page, you then return TRUE or FALSE.

    ~Brett

      I thought about something like that. The problem is that if they change their message even in the slightest, then it will always return false.

        Who are you validating through?

        ~Brett

          What aspect of RSS are you validating? Checking that the XML is well-formed?

          Checking XML for well-formedness is easy using the DOM functions in PHP.

          Validating all aspects of a RSS would trickier though.

          However, a well written (i.e. tested) RSS generator does not generate invalid feeds.

          Mark

            Write a Reply...