Validating all php generated html code?

Hello ruby team.
I got a new interesting assignment, to validate all html code of all our
products. Doing this manual would take me a very long time. Thus I seek
an
automated solution and wonder if anybody has done something similar?
Here is
what I think needs to be done:

  1. Generate each html page possible (the html code is created by MySQL
    and
    php scripts). It would be great to have a web crawler clicking each link
    at
    the web-site and saving the generated html-file.
  2. Validating all the html files
    Has anybody done something like this? Any ideas regarding what tools to
    use?
    Any recommendations, ideas, etc?
    Thanks for your help.
    Bernd