W3C home > Mailing lists > Public > www-validator-cvs@w3.org > January 2008

2008/link-testsuite http.php,NONE,1.1

From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
Date: Mon, 28 Jan 2008 02:16:09 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1JJJXd-0007M5-1I@lionel-hutz.w3.org>

Update of /sources/public/2008/link-testsuite
In directory hutz:/tmp/cvs-serv28247

Added Files:
	http.php 
Log Message:
simple php script to return various HTTP code responses

--- NEW FILE: http.php ---
<?php
$codes = array(
    "300" => "Multiple Choices",
    "301" => "Moved Permanently",
    "302" => "Found",
    "307" => "Temporary Redirect",
    "400" => "Bad Request",
    "401" => "Unauthorized",
    "402" => "Payment Required",
    "403" => "Forbidden",
    "404" => "Not Found",
    "405" => "Method Not Allowed",
    "406" => "Not Acceptable",
    "407" => "Proxy Authentication Required",
    "408" => "Request Time-out",
    "409" => "Conflict",
    "410" => "Gone",
    "411" => "Length Required",
    "412" => "Precondition Failed",
    "413" => "Request Entity Too Large",
    "414" => "Request-URI Too Large",
    "415" => "Unsupported Media Type",
    "416" => "Requested range not satisfiable",
    "417" => "Expectation Failed",
    "500" => "Internal Server Error",
    "501" => "Not Implemented",
    "502" => "Bad Gateway",
    "503" => "Service Unavailable",
    "504" => "Gateway Time-out",
    "505" => "HTTP Version not supported"
    );
    
// we only want to return a specific response code if the
// requested parameter matches what we know:
$code = NULL;
if ($_GET['code'] != '') {
    if(isset($codes[$_GET['code']])) {
        $code = $_GET['code'];
        header('', 
        TRUE, 
        (int) $code);
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>untitled</title>
	<meta name="author" content="olivier Thereaux">
</head>
<body>
<p><?php echo $code, " ", $codes[$code]; ?>
</body>
</html>
Received on Monday, 28 January 2008 02:16:24 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:55:00 GMT