howto POST and leave site?

B

botfood

I have used LWP UserAgent a couple times before to POST to a third
party site, and then parse what I needed out of the response... But
what I want to do now is set up appropriate fields as if from a FORM,
and POST them to an external URL, and turn the browser over to that
site rather than returning the response to my script...

How can this be done the simplest?

There are too many fields to set up as a GET and print as a Location
header....
 
B

Ben Morrow

Quoth "botfood said:
I have used LWP UserAgent a couple times before to POST to a third
party site, and then parse what I needed out of the response... But
what I want to do now is set up appropriate fields as if from a FORM,
and POST them to an external URL, and turn the browser over to that
site rather than returning the response to my script...

(I presume you are in a CGI context? It is necessary to state that,
here: many (most?) people using Perl are not using it for CGI.)
How can this be done the simplest?

In simple terms: it can't be done. HTTP doesn't have a redirect-to-POST
operation. This has nothing to do with Perl.

You could read the response and pass it straight through to the client,
probably adding a <base> element if the response is HTML. This has
nothing to do with Perl.

You could serve the client a page containing some JavaScript that makes
the appropriate form submission. This has nothing to do with Perl.

Ben
 
B

Brian McCauley

I have used LWP UserAgent a couple times before to POST to a third
party site, and then parse what I needed out of the response... But
what I want to do now is set up appropriate fields as if from a FORM,
and POST them to an external URL, and turn the browser over to that
site rather than returning the response to my script...

How can this be done the simplest?

Return an HTML document containing a form consiting entirely of hidden
fields and a bit of java script that submits that form as soon as the
page loads.
 
B

botfood

You could read the response and pass it straight through to the client,
probably adding a <base> element if the response is HTML.
---------

thanks for the good idea, the rightous repitition of 'nothing to do
with perl' I could do without. Use of the LWP is for sure perl, an
example of then making a sub in the $content string to add the
appropriate <base> tag text is a nice perl thing to do, and might solve
the issue I was seeing with broken relative links on the response html.

Seems that the perl newsgroup is the same as ever, brilliant, but with
an aweful lot of attitude. You must admit, the perl/cgi lines are
sometimes indistinct, and to choose the right tool in perl, you need to
know what it is used for.

anyway thank you for the idea.
 
K

Keith Keller

I use Perl in a CGI context, in a sysadmin context, in an
HTTP client context, in a database client context, in an
SMTP client context, and in many other contexts not related
to either CGI or sysadmin. Just because you don't doesn't
mean others don't. So yes, mentioning context *is* important.

--keith
 
T

Tad McClellan

[ attribution missing ]



I've supported my family for over 10 years on the back of Perl, and
am neither a sysadmin nor a web developer.
 
J

Jim Gibson

here: many (most?) people using Perl are not using it for CGI.)
[/QUOTE]

I use Perl and am neither a web developer nor a sys admin. While I have
written and maintain a few Perl CGI scripts, 95% of the Perl programs I
write are run using the command line from a Unix shell. So you can stop
wondering.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top