473,666 Members | 2,337 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reading XML POST-ed Data And Replying.

4 New Member
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 misunderstandin g 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 2342
menriquez
4 New Member
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 misunderstandin g 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 Recognized Expert Expert
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
menriquez
4 New Member
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 programmaticall y (using an IdHTTP object) so I am not sure how the "submit" is being processed...bas ically, 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 Recognized Expert Expert
Heya, Mark.

Are you using Indy? Is this HTML code designed to be loaded in a web browser?
Jun 27 '07 #5
menriquez
4 New Member
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
6596
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, it's a bit kludgy but it gets the right results. Thanks in advance.
4
3056
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
1900
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 read and manipulate the files of a directory. I asked a question about configuring this wonderful and helpful interface, and all I got was hostile and stupid messages with absolutely no answer to my question. I just wanted to tell you that I...
5
1971
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 that post. The post was not about strict or transitional pages, it wasn't even about
12
1737
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 awful. Is there something better? I do not want to use Outlook -- I do not trust it to refrain from opening executables. If anyone is interested, some of the problems with using IE with the MSDN newsgroups are as follows. The display doesn't...
1
3646
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 XmlException. The error message is invalid date SEMICOLON expected at Line 1 Position 380. Derek you had said something about the UTF encoding attribute in the xml declaration, it is in fact UTF-8. So if this is my problem or what is causing the...
10
1690
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
1968
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 always be able to find the folder if it's moved (i like this idea!) but I've had alot of trouble coding it even after tutorials I just need it to show me the path to the shared folder by reading that registly key.
12
1966
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 infile(filename.str().c_str()); string roomNameIn, roomDescriptionIn; int roomExitsIn; infile >> rnum;
13
1531
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 into an arraylist? I need to do some sort of commas split to just read the values and not the commas. Dim oFile As File Dim oRead As System.IO.StreamReader Dim EntireFile As String
0
8440
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8352
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8863
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8780
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7378
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6189
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4358
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.