Possible Duplicate:
How can one check to see if a remote file exists using PHP?
How to check if a webpage exists. jQuery and/or PHP
How can I check if a page from a different domain exists using php or javascript?
I've tried this:
function getURL($url, $includeContents = false)
{
if($includeContents)
return @file_get_contents($url);
return (@file_get_contents($url, null, null, 0, 0) !== false);
}
$test = getURL("http://www.google.com");
echo "<script language='javascript'>alert('$test');</script>";
but it doesn't work.
If I use a local url it works.
How to solve this?