Hiya, I'm no expert but I'd first of all get rid of the @ sign which is suppressing the error output from the function, then PHP may be able to give you a clue about what's going wrong.
Then I'd consider using these functions that a little surfing revealed here http://www.php.net/manual/en/function.file-exists.php
Function url_header returns the headers for that url, and url_exists is true if exists and false otherwise.
function url_header($url) {
$url = preg_replace('#http:#i', '', $url);
if (preg_match('#//#', $url)){
list(,,$domain, $file) = explode('/', $url, 4);
$file = "/$file";
} else {
$file = $url;
if (! preg_match('#/#', $file)) $file = "/$file";
$domain = $_SERVER[HTTP_HOST];
}
$fid = fsockopen($domain, 80);
if (! $fid) return "Host not responding";
fputs($fid, "HEAD $file HTTP/1.0\r\nHost: $domain\r\n\r\n");
$head = fread($fid, 4096);
fclose($fid);
echo "
\n<pre>\n$head<pre>";
return $head;
}
function url_exists($url) {
return preg_match('#HTTP/.*\s+200\sOK\s#i', url_header($url));
}
There are restrictions, I suggest you read all the user comments.
Hope this helps some.
John.