file exist on other server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xxoulmate
    New Member
    • May 2007
    • 77

    file exist on other server

    how to check if file exist on other server.,
    eg. server 1 is A
    server 2 is B

    in A there's a folder img and has a file test.txt inside
    in B there's a folder img2 and has a file test.txt inside
    A has a php program
    B has no php program

    this script below resides in server A
    Code:
    if (file_exists('/img/test.txt')) {
     echo "exists"; }
    how to use file_exists to check if test.txt is existing on server B/img2 folder
  • zorgi
    Recognized Expert Contributor
    • Mar 2008
    • 431

    #2
    Did you try using file_get_conten ts()

    Comment

    • Atli
      Recognized Expert Expert
      • Nov 2006
      • 5062

      #3
      Hey.

      You could also just send a typical HTTP request to server B to see if the file is available. - The get_headers() function would do fine here. Just check the first element it returns. If it is a 200 status code, the file exists. If not, it does not.

      Comment

      Working...