in reply to Re: Receiving POST
in thread Receiving POST

So know that *duh*. I know howto write a file upload script...

But someone sends XML with a post to my cgi|pl&url script. I just want to receive the file in a stream or something like that. Not in a file just a stream like to print to STDOUT that I immediatly can use.

That must be possible without HTML page!!!

Maybe my I can't explain properly what I mean *sigh*


--
My opinions may have changed,
but not the fact that I am right

Replies are listed 'Best First'.
Re: Re: Re: Receiving POST
by shotgunefx (Parson) on Jul 18, 2001 at 17:10 UTC
    I think you are misunderstanding how CGI works. HTML is just a user interface for the web. When a user has an HTML form, the browser takes that information and creates a POST request from the form data.

    You don't need an HTML form to send a post. You could generate an appropriate one yourself. One quick easy way to do it would be to have the sender code use LWP to make the POST request and use a regular CGI to process it.

    -Lee

    "To be civilized is to deny one's nature."
      Again. Who mentioned CGI. It isn't necessary in CGI. I know how LWP works to post something. I know that. I just told earlier I want to receive the XML stream posted to my https server. Can it be done just to receive the stream. I don't want that file upload thing 'cos that isn't what I need.

      Let me give a rough example.Watch out! insecure script: no use strict and -wT. Only used do demonstrate my intentions...
      The sending script:
      use LWP::UserAgent; $ua = new LWP::UserAgent; $ua->agent("PlanetXML/0.1 " . $ua->agent); my $req = new HTTP::Request POST => 'http://www.test.be/cgi-bin/xmlrec +eive.cgi'; $req->content_type('text/xml'); $content=<<END; <request> <header> <from>Sender</from> <to>Receiver</to> </header> <body> lots of stuff </body> </request> END $req->content($content); my $res = $ua->request($req); if ($res->is_success) { print $res->content; } else { print "Error\n"; }


      For the receiver: Maybe it's not ok what I do but it works :)
      use CGI; $q = new CGI; print $q->header; @name = $q->param('keywords'); print map("$_\n",@name);

      Hope this will show better what I mean!

      --
      My opinions may have changed,
      but not the fact that I am right