ah... your trying to check an URL? in that case you could try and use this, assuming the fopen is enabled on the server.
<?php
$file = "http://www.website.com/directory";
$fp = fopen($file,"r");
$getid = substr($fp,strlen($fp)-1);
if((integer)$getid==2) {
print "Could not open directory or directory does not exist";
}
else {
print "directory Found $file";
}
fclose($fp);
?>
hth