Jump to content

REST $_POST web service


rubing

Recommended Posts

I am trying to start a RESTful web service. The service would accept xml via $_POST.  And then respond with xml, for example:

 

<!-- Data Posted from user -->
<xvar></xvar>
<yvar></yvar>
<zvar>44</zvar>

<!-- Data Posted Back to user -->
<xvar>22</xvar>
<yvar>53</yvar>
<zvar>44</zvar>

 

 

How do I put this xml into $_POST and then accept process it and respond?  Is this a stream based procedure, or do I need to configure a socket that listens for it.

Link to comment
Share on other sites

Have you heard of cURL.  If not, just take a look at this shameless self promotion of my blog:

 

http://blog.cnizz.com/2007/05/02/phplinux-performing-an-http-post-the-easy-way/

 

Basically you have a page that accepts POST data, then the client (some other web server) has another page used to handle the data returned which is just another page that accepts POST data.  Its simple really, your other options is building a web service, but the cURL post method is much easier.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.