Sending data to third-party server then retrieving data back from third-party server

Is this possible within PHP:

  1. User fills in form on my site
  2. The form submits the data from the form to a third-party server somewhere else on the net, essentially handing off the data to the third-party server somehow
  3. Said third-party server does something with the data and then generates a numerical value to send back to my PHP script
  4. My server/PHP script gets that numerical value/data for use in the script again

Is it doable in PHP? Does PHP have inbuilt functions to perform the above tasks? Would such a thing require tons of advanced code or is it relatively easy to do?

Thanks in advance for any help on the matter

One quick question to you first:
Do the another third party server/site is also under your control? I mean you are the one to develop the script in third party server/site too? If yes then you can do it by using PHP but wouldn’t say that easier and neither that difficult to. If you have control of third party server too then have a look at PHP Curl. Or see some examples i.e.:
http://coderscult.com/php/php-curl/2008/05/20/how-to-post-data-with-curl-in-php/

http://www.askapache.com/php/sending-post-form-data-php-curl.html

If you are not the one to handle the script in third party then they (third party) should have provided some information/manual on how to send the data from your site to their site. Generally we call it WebService to send/share information between two servers. Depending upon the third party’s way of receiving data, you would need to learn/see some code in PHP accordingly.

The third-party server would have to specify how we connect with them. Assuming they have a way to let us connect, is it possible to do what i’ve proposed using PHP to send the data to them and then receive the data back off them once they send it back to us?

Yes that is quite possible but the “how” would depend on their way of receiving & sending back data.

Im looking to do the same thing, but I have to do 2 queries, 1 to get a “session key” from their site that is then used in the second query to lookup the data.
I already do this in ColdFusion, but I need to in PHP (Joomla!). PHP extreme-noob here.

The 2 queries I use in CF are (with specific data XXX’d out and opening < 's removed ):

#get session key

cfset urlAddress=“http://www.XXXXXXXX.com/xml?username=XXXXX;password=XXXXXXXXXX;agent=q5.0”>
cfhttp url=“#urladdress#” method=“GET” resolveurl=“Yes” throwOnError=“Yes”/>

cfset sitekey=item.Key.xmltext>

#/get session key

 THEN 

#query data

cfset urlAddress=“http://www.XXXXXX.com/xml?s=#sitekey#;username=#user-var#”>
cfhttp url=“#urladdress#” method=“GET” resolveurl=“Yes” throwOnError=“Yes”/>

cfset xmlDoc = XmlParse(CFHTTP.FileContent)>
cfset resources=xmlDoc.xmlroot.xmlChildren>
cfset numresources=ArrayLen(resources)>
cfset item=resources[1]>

cfset newusername = (“item.username.xmltext”)>

…etc etc etc…

#/query data

I would hope as good as PHP is, this would be fairly simple, but again, Im just starting the dive into PHP.

Thanks
Jim