Server to server communication

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
samdv
Forum Newbie
Posts: 3
Joined: Fri Apr 28, 2006 7:55 am
Location: Leeds, UK

Server to server communication

Post 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
EricS
Forum Contributor
Posts: 183
Joined: Thu Jul 11, 2002 12:02 am
Location: Atlanta, Ga

Post by EricS »

samdv
Forum Newbie
Posts: 3
Joined: Fri Apr 28, 2006 7:55 am
Location: Leeds, UK

POSTing data

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

cURL (if available) might be a much simplier option
EricS
Forum Contributor
Posts: 183
Joined: Thu Jul 11, 2002 12:02 am
Location: Atlanta, Ga

Post 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
samdv
Forum Newbie
Posts: 3
Joined: Fri Apr 28, 2006 7:55 am
Location: Leeds, UK

curl

Post 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
Post Reply