2

Am new to php. I have a php script running on server1 and another php script on server 2. To make a remote call from server 1 to server2, I use curl functions. As per your posts on 'PHP: Remote Function Call and returning the result?' I can read the string on server2.

But, my server2 has a function that returns a string value. Now, from server1 I need to get the return value from the function on server2. Could you please let me know how to make a call to a function on the remote server?

Community
  • 1
  • 1

1 Answers1

1

if you want to pass data between 2 separate servers like this, then you need to choose a transport layer, XML or JSON are both good and PHP offers built in parsing for both.. personally I prefer JSON.

server 1 will hit server 2 using http... the request data should be in the POST of GET.... server 2 will return the result over http... server 1 then parses the resulting JSON or XML.

Server 2 will basically "echo" the result data. XML or JSON will help structure array data results and save you having to parse text data echoed from server 2.

You will obviously need to add some security to make sure no one else can hit server 2.

Nick
  • 908
  • 12
  • 29