Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Receiving POST

by Sinister (Friar)
on Jul 18, 2001 at 15:13 UTC ( [id://97605]=note: print w/replies, xml ) Need Help??


in reply to Receiving POST

a CGI script is started on request of the webserver.
You should build an HTML page, containing a file input type (make sure the form tag contains: ENCTYPE="multipart/form-data") and a cgi script. ready to receive a paramter (file) by what ever name you gave the file input field

Have fun fiquring the pitt-falls out... ;-)

Sinister greetings.
perldoc -q $_

Replies are listed 'Best First'.
Re: Re: Receiving POST
by toadi (Chaplain) on Jul 18, 2001 at 16:48 UTC
    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

      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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://97605]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-19 22:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found