Code: Select all
fputs($fp, 'GET / HTTP/1.0'.PHP_EOL.'Host: http://www.devnetwork.net'.PHP_EOL.PHP_EOL);Code: Select all
fputs($fp, 'GET / HTTP/1.0'.PHP_EOL.'Host: $URL'.PHP_EOL.PHP_EOL);Moderator: General Moderators
Code: Select all
fputs($fp, 'GET / HTTP/1.0'.PHP_EOL.'Host: http://www.devnetwork.net'.PHP_EOL.PHP_EOL);Code: Select all
fputs($fp, 'GET / HTTP/1.0'.PHP_EOL.'Host: $URL'.PHP_EOL.PHP_EOL);Code: Select all
fputs($fp, 'GET / HTTP/1.0' . PHP_EOL . 'Host: ' . $URL . PHP_EOL . PHP_EOL);Code: Select all
<?php
function checkValidURL ($URL) {
$fp = @fsockopen($URL, 80, $errno, $errstr,30);
if ($fp) {
fputs($fp, 'GET / HTTP/1.0' . PHP_EOL . 'Host: ' . $URL . PHP_EOL . PHP_EOL);
do {
$sourceCode = fread($fp, 512);
#echo $sourceCode;
return TRUE;
}
while (strlen($sourceCode));
} else {
return FALSE;
}
}
function checkURLForLink () {
//
}
$isValid = checkValidURL ("http://www.evolution-interactive.co.uk");
if ($isValid === TRUE) {
echo 'Site is valid';
} else {
echo 'Site is invalid';
}
?>- 1xx: Informational - Request received, continuing process
- 2xx: Success - The action was successfully received,
understood, and accepted
- 3xx: Redirection - Further action must be taken in order to
complete the request
- 4xx: Client Error - The request contains bad syntax or cannot
be fulfilled
- 5xx: Server Error - The server failed to fulfill an apparently
valid request