Examples

Examples – Using Services_W3C_HTMLValidator

Getting results from the HTML Validator

The following examples demonstrate how to get validation results from an instance of the W3C HTML Validator.

Validate by URI

This is a simple example which shows how to validate a URI and return whether the page is valid or not.

<?php
require_once 'Services/W3C/HTMLValidator.php';

$v = new Services_W3C_HTMLValidator();
$u 'http://www.unl.edu/';
$r $v->validate($u);

if (
$r->isValid()) {
    echo 
$u.' is valid!';
} else {
    echo 
$u.' is NOT valid!';
}
?>