uri = $uri; $this->checkUri = sprintf($this->validatorUri, $uri); $snoopy = new SnoopyPlus; $snoopy->fetch($this->checkUri); $status = $snoopy->getHeader('x-w3c-validator-status'); if (!$status) { /* The Validator chucked back XHTML for some reason, create error */ $result = new ValidationResults; $result->uri = $this->uri; $result->status = 'Failed'; $result->errormsg = 'The validator did not return a valid response. This almost certainly means your page was invalid. Remember that the validator is still a beta product.'; return $result; } /* Status is fine - parse the results */ $parser = new ValidationParser; if (!$parser->parse($snoopy->results)) { // XML parsing failed for some reason $result = new ValidationResults; $result->uri = $this->uri; $result->status = 'Failed'; $result->errormsg = 'The validator did not return a valid response - the returned XML was malformed. Remember that the validator is still a beta product.'; return $result; } /* Parsing worked fine, return the result */ $result = $parser->results; $result->uri = $this->uri; $result->status = $status; return $result; } } ?>