By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,359 Members | 1,543 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,359 IT Pros & Developers. It's quick & easy.

Reading XML POST-ed Data And Replying.

P: 4
Hi...I am trying to write a test html/php app that accepts some POSTed XML data and replies with (for now) an echo of the $_POST array. Here is my index.htm..

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
  2. <html>
  3.   <head>
  4.     <title>XML POST Test v1.0</title>
  5.   </head>
  6.   <body>
  7.  
  8.     <form id="Form1" action="POST" method="post.php">
  9.       <!-- Input elements will be put here -->
  10.     </form>
  11.     This is the POST test index.htm page...
  12.   </body>
  13. </html>
...and my post.php..

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.   echo '<result>'
  3.   echo $_POST;
  4.   echo '</result>'
  5. ?>
The problem is that post.php is not being called after I call the IdHttp.Post(...) method in my external app...I am just getting a dump of the index.htm as a reply.

I probably have some fundemental misunderstanding of how POST is handled...i was assuming that any POST-ed data trigger a call to post.php, but it does seem to work that way...

Any idea appreciated!

- mark
Jun 27 '07 #1
Share this Question
Share on Google+
5 Replies


P: 4
Hi...I am trying to write a test html/php app that accepts some POSTed XML data and replies with (for now) an echo of the $_POST array. Here is my index.htm..

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
  2. <html>
  3.   <head>
  4.     <title>XML POST Test v1.0</title>
  5.   </head>
  6.   <body>
  7.  
  8.     <form id="Form1" action="post.php" method="POST">
  9.       <!-- Input elements will be put here -->
  10.     </form>
  11.     This is the POST test index.htm page...
  12.   </body>
  13. </html>
...and my post.php..

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.   echo '<result>'
  3.   echo $_POST;
  4.   echo '</result>'
  5. ?>
The problem is that post.php is not being called after I call the IdHttp.Post(...) method in my external app...I am just getting a dump of the index.htm as a reply.

I probably have some fundemental misunderstanding of how POST is handled...i was assuming that any POST-ed data trigger a call to post.php, but it does seem to work that way...

Any idea appreciated!

- mark
Please notice that I fixed the minor syntax error from the first post...the code still does not work. Sorry.

- mark
Jun 27 '07 #2

pbmods
Expert 5K+
P: 5,821
Heya, Mark. Welcome to TSDN!

What happens when you submit the form? Does it go to post.php, or does it reload the current page?

Also, you may want to do this instead:
Expand|Select|Wrap|Line Numbers
  1. echo '<![CDATA[' . json_encode($_POST) . ']]>';
  2.  
echoing $_POST will just output 'Array'.
Jun 27 '07 #3

P: 4
Heya, Mark. Welcome to TSDN!

What happens when you submit the form? Does it go to post.php, or does it reload the current page?

Also, you may want to do this instead:
Expand|Select|Wrap|Line Numbers
  1. echo '<![CDATA[' . json_encode($_POST) . ']]>';
  2.  
echoing $_POST will just output 'Array'.
First of all, thanks for your kind welcome and your echo suggestion has been implemented...

yes you have hit on the problem i think...the POST is being done programmatically (using an IdHTTP object) so I am not sure how the "submit" is being processed...basically, I am trying to implement a REST-like system so thrid-parties can POST input xml to a webpage and I return xml depending upon the results.

Maybe someone has a link some pre-existing PHP solution to this problem...I doubt I am the only one trying to do this...

- mark
Jun 27 '07 #4

pbmods
Expert 5K+
P: 5,821
Heya, Mark.

Are you using Indy? Is this HTML code designed to be loaded in a web browser?
Jun 27 '07 #5

P: 4
Heya, Mark.

Are you using Indy? Is this HTML code designed to be loaded in a web browser?
Yes I am using INDY and the the code is *not* designed for a web browser...in my last comment I had an "a-ha" moment when I realized that I was actually doing a REST-y thing, so I found this to chew on...

http://www.isolani.co.uk/blog/atom/P...Implementation

...if you have any ideas to use INDY components to do this easier then apache/php, I am all ears.

- mark
Jun 27 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.