Page 1 of 1

Server to server communication

Posted: Fri Apr 28, 2006 8:01 am
by samdv
Hi guys,

I've put together a website in PHP and one of the things it has to do is take a load of user-submitted information (so far so good) convert it to XML on the server (also fine) then submit the XML to another server from which a response will be received and then the response relayed to the original user.

I'm fine with the client-server stuff, but how do you go about sending information server-server using PHP in the middle of an application?

Any help would be much appreciated! Cheers!

Sam

Posted: Fri Apr 28, 2006 8:12 am
by EricS

POSTing data

Posted: Fri Apr 28, 2006 8:43 am
by samdv
Just had a look through that information on using sockets in PHP - I have been told that the data from the user should be collected by my server and parsed into XML. Then an SSL connection should be set up between my server and the other server so my server can POST the XML.

Will sending the data via the socket connection have the same effect as an HTTP POST METHOD? I don't want to spend loads of time doing it this way unless I'm quite confident that the other server will be able to pick up the data I send and respond accordingly.

Cheers!

Sam

Posted: Fri Apr 28, 2006 8:47 am
by feyd
using cURL would be easier in this instance, however sockets can do it too, just with a lot more code and time to build.

Posted: Fri Apr 28, 2006 8:47 am
by Weirdan
cURL (if available) might be a much simplier option

Posted: Fri Apr 28, 2006 8:51 am
by EricS
cURL is a much simplier option when it's available.

Sockets give you total control over the network communication because they are implement at a lower level in the network stack. But they require you know a lot about the transport protocol you intent to use (TCP/IP in this case).

- Eric

curl

Posted: Fri Apr 28, 2006 9:07 am
by samdv
Yeah, I've messed around with sockets before but not using PHP, and to be honest I was dreading it - curl seems like a much more accessible alternative, thanks for all of your help guys - much appreciated!

Sam