SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot dizyn's Avatar
    Join Date
    Apr 2006
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to access folders

    Hi

    I want to access folders on other server using php code, can i do this?

    I have two server and I want to see if folder abc exists on 2nd server, how can i do this?

    Thanks

  2. #2
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    If you have FTP access to both servers, you can use PHP's built-in FTP capabilities.

    If you don't have file access to the other server, you could test it over HTTP but this isn't at all reliable.

    Maybe a simpler option for you would be to have a script which echos '1' or '0' depending on whether a given folder (passed over $_GET) exists - and call this script from the other server over HTTP using something like:
    PHP Code:
    $FolderExists file_get_contents('http://www.yourothersite.com/direxists.php?dir=Images') == '1' true false
    .
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  3. #3
    SitePoint Zealot dizyn's Avatar
    Join Date
    Apr 2006
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for your reply.

    I think ftp can be good, can you please tell me how can i do this using ftp? I mean what function i should use to do this?

    thanks again.

  4. #4
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  5. #5
    SitePoint Zealot robinInTexas's Avatar
    Join Date
    Feb 2009
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dizyn View Post
    thanks for your reply.

    I think ftp can be good, can you please tell me how can i do this using ftp? I mean what function i should use to do this?

    thanks again.
    ftp_connect

    ftp_chdir
    Robin
    Find out how to get More Money at this URL


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •