473,406 Members | 2,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Reading XML POST-ed Data And Replying.

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
5 2334
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
5,821 Expert 4TB
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
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
5,821 Expert 4TB
Heya, Mark.

Are you using Indy? Is this HTML code designed to be loaded in a web browser?
Jun 27 '07 #5
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

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

Similar topics

6
by: Dietrich Epp | last post by:
Are there any good modules for reading a bitstream? Specifically, I have a string and I want to be able to get the next N bits as an integer. Right now I'm using struct.unpack and bit operations,...
4
by: Xah Lee | last post by:
# -*- coding: utf-8 -*- # Python # to open a file and write to file # do f=open('xfile.txt','w') # this creates a file "object" and name it f. # the second argument of open can be
5
by: perseus | last post by:
Well, As you all have seen, I received a host of messages that say that I should not post up here a question about BOOST. BOOST is a FREE interface that allows you, THE STANDARD C++ USERS, to...
5
by: Abyss | last post by:
My view. anyone that doesn't like it tough, click off and stop reading it. I have spent the last 45 minutes reading through all the posts, and I believe that you have all missed the mark of...
12
by: Andrew | last post by:
What do people use to read these newsgroups? I have been using my web browser (IE) and pointing it to "http://msdn.microsoft.com/newsgroups/". The experience doing this has been pretty much...
1
by: Ldaled | last post by:
Okay, I had a previous post called reading an XML document. Since this post I have revised my code and got it to work. Now, Like Derek had mentioned in answer to my previous post, I am getting an...
10
by: T Cordon | last post by:
I am using a StreamReader to read text from an HTML file and display it as part of a page in a Label Control. Buy it is not displaying characters as: ñ, ó, ú, etc. Please Help. Thanks
2
by: zoneal | last post by:
my program it's just tools for my little home network.. Only thing I have left to do is reading the registy key to check the path to the shared folder.. this path is always updated so I will...
12
by: Felix85 | last post by:
here is my method for reading in a file: static room room::file2Room(int rnum){ ostringstream filename; filename << "../gamefiles/rooms/" << rnum << ".room"; ifstream...
13
by: cmdolcet69 | last post by:
I have this code below that will open a created file and read the file to the end. However if my file has values 200,300,400 seperated by commas how can i read in each seperate value and place it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.