SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot usmangt's Avatar
    Join Date
    Apr 2009
    0 Post(s)
    0 Thread(s)

    PHP Send data to another Server


    I have a php script which gets data from the server A using shell_exec() and then save its results to a variable (I have three variables i.e. $Username, $Status, $IP). Then i display them as needed.

    Now i want to send these data to Server B and there i want to display the results of these variables.

    I have found some curl script

    But i am confused because I am not sure how to do it in a real server , i.e. how to connect to the Server A. In the above line there is nothing mentioned about the connection to ServerB

    Also , Will it work on a shared server (which normally uses cPanel).



  2. #2
    Avid Logophile silver trophy
    ParkinT's Avatar
    Join Date
    May 2006
    Central Florida
    192 Post(s)
    4 Thread(s)
    In the above line there is nothing mentioned about the connection to ServerB
    In the script you referenced, the variable $url contains THE OTHER server address.
    This need not (necessarily) be a domain name, it could be the IP address of the other server.
    One server is 'feeding' the values in a PHP script and the other 'reads' the output of that page.

    If you simply need to pass data (information) between servers, you should investigate SCP.
    Don't be yourself. Be someone a little nicer. -Mignon McLaughlin, journalist and author (1913-1983)

    Git is for EVERYONE
    Literally, the best app for readers.
    Make Your P@ssw0rd Secure
    Leveraging SubDomains

  3. #3
    I solve practical problems. bronze trophy
    Michael Morris's Avatar
    Join Date
    Jan 2008
    Knoxville TN
    66 Post(s)
    0 Thread(s)
    cURL is for situations where your server must act as a client - most frequently with payment gateways. The SSH2 functions (of which scp is a part) come up more rarely. I'm working on a script right now that does this using this library

    I don't know if there's anything more recent out there - the version of that library the code I inherited is using was written for PHP 4. It seems to work well enough though.


Posting Permissions

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