Reading XML POST-ed Data And Replying.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • menriquez
    New Member
    • Jun 2007
    • 4

    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..

    [CODE=html]<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
    <html>
    <head>
    <title>XML POST Test v1.0</title>
    </head>
    <body>

    <form id="Form1" action="POST" method="post.ph p">
    <!-- Input elements will be put here -->
    </form>
    This is the POST test index.htm page...
    </body>
    </html>[/CODE]

    ...and my post.php..

    [CODE=php]<?php
    echo '<result>'
    echo $_POST;
    echo '</result>'
    ?>[/CODE]

    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
  • menriquez
    New Member
    • Jun 2007
    • 4

    #2
    Originally posted by menriquez
    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..

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
    <html>
      <head>
        <title>XML POST Test v1.0</title>
      </head>
      <body>
      
        <form id="Form1" [B]action="post.php" method="POST"[/B]>
          <!-- Input elements will be put here -->
        </form>
        This is the POST test index.htm page...
      </body>
    </html>
    ...and my post.php..

    Code:
    <?php
      echo '<result>'
      echo $_POST;
      echo '</result>'
    ?>
    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

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #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:
      [code=php]
      echo '<![CDATA[' . json_encode($_P OST) . ']]>';
      [/code]

      echoing $_POST will just output 'Array'.

      Comment

      • menriquez
        New Member
        • Jun 2007
        • 4

        #4
        Originally posted by pbmods
        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:
        [code=php]
        echo '<![CDATA[' . json_encode($_P OST) . ']]>';
        [/code]

        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

        Comment

        • pbmods
          Recognized Expert Expert
          • Apr 2007
          • 5821

          #5
          Heya, Mark.

          Are you using Indy? Is this HTML code designed to be loaded in a web browser?

          Comment

          • menriquez
            New Member
            • Jun 2007
            • 4

            #6
            Originally posted by pbmods
            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...



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

            - mark

            Comment

            Working...