Check the response to an HTTP request with a URL
How search engine crawlers do they see your Web pages, what information is returned in response to an HTTP request.
This is an example of interface, it is not functional, download the script linked below to get a fully functional tool.
Enter full URL to test:
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 returned: $code ";
$label = "";
switch(intval($code))
{
case 200: $label= " OK ";break;
case 301: $label= " Permanent redirect"; break;
case 302: $label= " Temporary redirect"; break;
case 404: $label= " Page not found"; 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);
More
- Get the full demo with the code.
- How to get the HTTP status code of a webpage?
- List of all HTTP codes .