1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Server to server in LAN

Discussion in 'PHP' started by cheapez, Jul 5, 2012.

  1. #1
    So, I have 5-6 pages of requirements. I'm trying to build this application in PHP based on the requirements.

    I want to transfer files from one server to the other server in LAN, and then send a shell command to the other server to find out if the file has been transferred successfully.

    In php, I can transfer files using FTP, and send shell commands using SSH.

    Using the methods above, I will need to open the connection with the server first, but I don't know the ftp server name, domain name, ip address, or anything like that.

    I only know the the server ID (I'm not sure what this ID is, but I guess it is like the computer's name).
    An example of the server ID is: "c23bap234"

    How do I open a connection with just that server ID? These servers are in the same building, have LAN connection, don't have connection to the outside world. These machines have PHP, Apache, ... installed.

    If my post doesn't make sense to you, it's because I'm a learner. I hope someone can help me on this.
    Thanks in advance.
    SEMrush
     
    Last edited: Jul 5, 2012
    cheapez, Jul 5, 2012 IP
    SEMrush
  2. gapz101

    gapz101 Well-Known Member

    Messages:
    524
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    150
    #2
    Try ping or tracert commands. Are these servers windows or linux or what ?
     
    gapz101, Jul 5, 2012 IP
  3. cheapez

    cheapez Active Member

    Messages:
    1,123
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    78
    #3
    I can tell you that they are window servers, but I'm not 100% sure.
    What would be the different between the two? I can run shell commands on windows but not Linux?

    I don't know what to do with the ping, and tracert commands. I have a general idea, but can you give more details?

    Thank you.
     
    cheapez, Jul 5, 2012 IP
  4. gapz101

    gapz101 Well-Known Member

    Messages:
    524
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    150
    #4
    In case of windows, you can run ping or tracert and it will give you the ip. You need to open command prompt (Start > Run > type "cmd" w/o quotes).
    then issue these commands:
    
    ping c23bap234
    
    Code (markup):
    
    tracert c23bap234
    
    Code (markup):
    "c23bap234" is the computer name of the server.
     
    gapz101, Jul 5, 2012 IP
  5. cheapez

    cheapez Active Member

    Messages:
    1,123
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    78
    #5
    I have used ping, and tracert a few times before.
    I can just type in the "computer name", and it will find out the ip address for me?
    what if I type in the name of the other computer in the same Lan network? will it find out the ip address of that computer?

    I'm supposed to build an application that will run on one of these servers.
    I can use $_SERVER['REMOTE_ADDR'] to find out the ip of the host server.
     
    cheapez, Jul 6, 2012 IP