www.webdeveloper.com
Results 1 to 3 of 3

Thread: Copy Files from one server to another using PHP

  1. #1
    Join Date
    Apr 2007
    Posts
    99

    Thumbs up Copy Files from one server to another using PHP

    Hi ,
    I have hosted my web site on one server (server 1)and my media files are stored on other server (server 2). Now server 2 has sftp login system. Server2 is the media server.

    When the user enter his username on my web page on server1 , I want to list all the files from server2 on to this web page. So how can I write a script that would allow me to login to server2 which has sftp and get the list of the files.
    All files are stored in following format

    GourpID - UserId -media<computer generated random number).flv

    eg.
    abc-23-meadi00038578.flv

    If we cannot do it with Php then what would be the best way to do it.

  2. #2
    Join Date
    Mar 2007
    Location
    Canada
    Posts
    99
    You could have a basic php script on Server 2 that accepts a secret key so it can list user's files.

    let's say server2/sys/app/list-files.php?secret=abc12345&user_id=123

    For additional security on Server 2 you might want to also check for the REMOTE_ADDR in list-files.php

    Another option is to setup key based login and use ssh to list users files.

    hope this gives you an idea how to proceed.

  3. #3
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,408
    Maybe use PHP's FTP functions?
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles