Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LWP POST then redirect

Status
Not open for further replies.

uniopp

Technical User
Oct 7, 2001
152
JP
Hi,
Can anyone help me with this?
What I have is -
perl_script1 submits some data to perl_script2 on another server using a regular html form. The data is processed and returned to perl_script1 using a LWP POST. Perl_script 1 then processes the data and prints an html page.
What I have noticed is that the url shown on the browser stays on perl_script2's url after the LWP.
How do I get the url to return to perl_scipt1's url?
Preferably I don't want perl_script2's url to show at all.
Is there something I can add to the following code to redirect the url on POSTing the data??

# Create a user agent object
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->agent("AgentName/0.1 " . $ua->agent);

# Create a request
my $req = new HTTP::Request POST => ' $req->content_type('application/x- $req->content($redirect);

# Pass request to the user agent and get a response back
my $res = $ua->request($req);

# Check the outcome of the response
if ($res->is_success) {
print $res->content;
} else {
print "Bad luck this time\n";
}

Thank you.
Simon.
 
If perl_script1 submits tha data - how does it change the URL at all?

Can you explain som more as to what you're trying to do?
 
Good question!
When I started to re-write my explanation below I realized what you meant. I'm not sure what is causing it to change the url because all I am doing is submiting a form (which shouldn't redirect on it's own) using <form method=&quot;post&quot; action=&quot;
The starting point is which is an html form generated by the script. When the user submits the form it POSTs the data to and the url at that point is is still When perl_script2 returns the processed data the url changes to and remains there even though the perl_script1 user continues to make additional form submissions from within perl_script1.
Something strange is going on. Perl_scipt2 seems to take over from the point where it sends back a response using LWP POST.
Any ideas????
Thank you.
Simon.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top