Try something like:
if ($_REQUEST[url] != "") {
$result = 1;
if (! ereg("^https?://",$_REQUEST[url])) {
$status = "This demo requires a fully qualified http:// URL";
} else {
if (@fopen($_REQUEST[url],"r")) {
$status = "This URL s readable";
} else {
$status = "This URL is not readable";
}
}
} else {
$result = 0;
$status = "no URL entered (yet)";
}
Then you can call this function using:
if ($result != 0) {
print "Checking URL <b>".htmlspecialchars($_REQUEST[url])."</b><br />";
}
print "$status";
source
share