If I understand correctly you want to redirect a POST request as a POST to the other site. This is possible (well, most of it is; I'm not entirely sure about the file fields) but it can be a pain. The last time I did this was about 4 years ago and the different browsers (Safari at least; which IIRC was the only one which followed the HTTP spec strictly) handled this differently.

I'd actually love to help you but it's been long enough that I'd have to do an hour or two of digging and I've got other fish to fry right now. I just wanted you to know that it is possible. But as the kittehs says: yur doin it rong.

You'll need to construct a POST request. Perhaps with HTTP::Request::Common, perhaps there is a way to tease the request out of WWW::Mechanize but you do not want to $mech->submit the request, you want to use its body in a redirected POST which ends up submitted by your user. The file upload fields are the tricky part and you should verify with some object dumps that they are getting loaded into the POST as complete multi-part data. I recommend using a couple of *small* test files like test.txt and test.gif to eyeball. A big gene file or something is going to make visually inspecting the POST a drag.

User -> GET something from your CGI Your CGI -> Construct POST body that Molsurfer accepts -> Give User a POST redirect with the POST body -> Redirect status should be 303, I think (or maybe 302; test on different browsers)

In reply to Re: redirecting, html forms, mechanize by Your Mother
in thread redirecting, html forms, mechanize by RobertCraven

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.