Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^4: Shortest/quickest way for Perl to take POST data it receives and send a POST request with this data to another URL?

by tunafish (Beadle)
on Nov 05, 2013 at 08:31 UTC ( [id://1061270]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Shortest/quickest way for Perl to take POST data it receives and send a POST request with this data to another URL?
in thread Shortest/quickest way for Perl to take POST data it receives and send a POST request with this data to another URL?

Stupid people write unclear questions!

I meant -- I guess incorrectly -- that this is not a redirect in the HTTP sense of it. There will not be a 301, 302 or 303 HTTP response to the user's POST request. The user will not be sent to interact directly with script 2. All of this action is happening behind the scenes. The user interacts with script 1 from start to finish, but at a certain point, script 1 sends a POST request to script 2.

Edited to add: Just re-read the original question. I did specifically ask about how to have one script send a POST request to a second script, so I'm really not sure how that was an "unclear question". I think you read into the question something that I didn't actually ask.

Replies are listed 'Best First'.
Re^5: Shortest/quickest way for Perl to take POST data it receives and send a POST request with this data to another URL?
by Your Mother (Archbishop) on Nov 06, 2013 at 06:12 UTC
    Stupid people write unclear questions!

    How intelligent one is has little to no direct bearing on how well one communicates. It's a skill, not a trait.

    While as lacking in implementation specifics as your question, you have at least two answers -- zentara's and mine -- that seem to address what you want and the various proxy answers might as well. You'll either have to be much more specific, as with some sample code and expected behavior, or do some reading and experimenting with the tools you've been handed.

      If you had a single url to rewrite; and weren't already using Plack, would you really install this lot rather than write a 10-line LWP::Simple script?


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        If I didn't know Plack, no, but I do (and am trying to improve my knowledge in the area) so, yes. PSGI middlewares (Plack::Middleware) for example add a huge amount of drop-in utility that otherwise range from difficult to dirty to hack up in a hand rolled version built for a single purpose. The script could proxy or not by a map of URLs, do custom authentication in front of some, run an arbitrary number of other apps/CGIs (Catalyst/Dancer/PHP/Whatever) alongside a proxy (which would require more than a one liner in this case), display show|hide timing/debug/env in the page with JS. Each addition being one to five or six new lines of code. You also get multiple deployment options, uWSGI, Starman, Twiggy, FCGI, and several more.

        Nothing wrong with bare bones Perl. Kits like Plack give you easy room for growth and adjustment.

Re^5: Shortest/quickest way for Perl to take POST data it receives and send a POST request with this data to another URL?
by BrowserUk (Patriarch) on Nov 06, 2013 at 04:16 UTC

    Seems I wasn't the only one who found your question unclear.

    As a pure aside, perhaps what you want it not a formal http redirect, but rather a server rewrite. Whether your server supports it; even whether it is right for your application; I frankly neither know nor care. It's just something I encountered briefly several years ago and pass on in an 'information only' spirit.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-03-28 11:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found