Using PHP to figure out if an external file exists on other servers
<p>I'm requesting from the html form the url, and then posting it into php and running an if file exsists, and then with jquery I'm returning the if the file is found it overrides the report message.</p>

<p>Take a look at my code below.. the only problem is that I have not been able to actually get a page found response so I'm thinking there is something wrong with the PHP file_exsists command.</p>

<pre><code>&lt;?php

    header('Access-Control-Allow-Origin: *');  

    $filename = $_POST["find-one"];
    $filename2 = $_POST["find-two"];

?&gt;
&lt;html&gt;
    &lt;header&gt;
        &lt;title&gt;404 Tool&lt;/title&gt;
        &lt;script type="text/javascript" src=".../1.7.1/jquery.min.js"&gt;&lt;/script&gt;
        &lt;?php
            if (file_exists($filename)) {
              echo "&lt;script&gt;
                      $(document).ready(function() { 
                        $('.report-one').text('File $filename is found.');
                      });
                    &lt;/script&gt;";
            } else {
              echo "&lt;script&gt;
                      $(document).ready(function() { 
                        $('.report-one').text('File $filename doesn't exsist.');
                      });
                    &lt;/script&gt;";
            }

            if (file_exists($filename)) {
              echo "&lt;script&gt;
                      $(document).ready(function() { 
                        $('.report-two').text('File $filename2 is found.');
                      });
                    &lt;/script&gt;";
            } else {
              echo "&lt;script&gt;
                      $(document).ready(function() { 
                        $('.report-two').text('File $filename2 doesn't exsist.');
                      });
                    &lt;/script&gt;";
            }
        ?&gt;
    &lt;/header&gt;
    &lt;form method="post" action="&lt;?php echo $PHP_SELF;?&gt;"&gt; 
      &lt;input type="text" name="find-one" class="find-one"/&gt;
      &lt;p class="report-one"&gt;Waiting&lt;/p&gt;
      &lt;input type="text" name="find-two" class="find-one"/&gt; 
      &lt;p class="report-two"&gt;Waiting&lt;/p&gt;
      &lt;input type="submit" value="Search for 404's"&gt;
    &lt;/form&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>
