Validate HTTP Response at URL

How do browsers and search engine robots see your web pages, what information did they return in response to an HTTP request?

Here is the script that performs the test, sends a request to the URL you specified, and displays the code returned by the server. The archive includes a form for entering a URL and a JavaScript script for running a PHP script on a remote or local server .

Source code

function sockAccess($server, $page)
{
$errno="";
$errstr="";
$fp=0;
$fp=fsockopen($server, 80, $errno, $errstr, 30);
if($fp===0)
{
die("Error $errstr ($errno)");
}
$out="GET /$page HTTP/1.1\r\n";
$out.="Host: $server\r\n";
$out.="Connection: Close\r\n\r\n";
fwrite($fp,$out);
$content = "";
$counter = 0;
while (!feof($fp) && $counter < 8)
{
$line = trim(fgets($fp, 128));
if($counter == 0)
{
$code=trim(substr($line,9,4));
$content = "<strong>Code retour: $code ";
$label = "";
switch(intval($code))
{
case 200: $label= " OK ";break;
case 301: $label= " Redirection permanente"; break;
case 302: $label= " Redirection temporaire"; break;
case 404: $label= " Page non trouvée"; break;
default:break;
} $content.= $label."</strong><br><br>";
}
$content .= $line . "<br>";
$counter++;
}
fclose($fp);
return $content;
}
$url = $_POST['url'];
$parsed = parse_url($url);
$server = $parsed['host'];
$page = $parsed['path'];
$content=sockAccess($server, $page);
print_r($content);

Loading

Further information