No such thing as a small change | |
PerlMonks |
Re: 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 05, 2013 at 19:06 UTC ( [id://1061358]=note: print w/replies, xml ) | Need Help?? |
As someone mentioned, the easiest/shortest way is with a proxy; e.g., Plack::App::Proxy– Plack::App::Proxy->new(remote => 'http://perl.org')->to_app;That could be wrapped up in a proper script to control URIs and capturing data and what gets proxied and what doesn't, etc. Because I was curious, I tried whipping up a Plack::Request/HTTP::Response based version. Turns out it's quite easy. Though it seems to work, this code is a simplistic first stab and I have no idea how fit it is for your, or any, actual task. The code is shown after the usage… I admit it's confusing, but it was more fun/terse to have the code display itself. Run itI stripped some headers (Host/Agent/Accept) from the output to save space.
Use it
Have it echo its own code :PDemonstrate that file uploads (apparently) work fine too.
In Section
Seekers of Perl Wisdom
|
|