title: How to check if page exists?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/981954/how-can-one-check-to-see-if-a-remote-file-exists-using-php">How can one check to see if a remote file exists using PHP?</a><br>
    <a href="https://stackoverflow.com/questions/3536118/how-to-check-if-a-webpage-exists-jquery-and-or-php">How to check if a webpage exists. jQuery and/or PHP</a>  </p>
  </blockquote>
  
  
  
  <p>How can I check if a page from a different domain exists using php or javascript?</p>
  
  <p>I've tried this:</p>
  
  <pre><code>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 "&lt;script language='javascript'&gt;alert('$test');&lt;/script&gt;";
  </code></pre>
  
  <p>but it doesn't work.</p>
  
  <p>If I use a local url it works.</p>
  
  <hr>
  
  <p>How to solve this?</p>