|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Hi
i am using LWP::UserAgent to post some values to a script (in ASP), which then redirects to show a search results page, however when i use LWP::UserAgent i get a 302 Object Moved message and no re-direct occurs Is there a way to get round this problem , possibly by sending another header , i am not sure how this can be done , any help would be gratefully accepted Waseem ------------------ visit the next big thing in Information Technology http://www.itstop.com pre-register now Into sport ? goto http://www.sportwebpages.com |
|
#2
|
|||
|
|||
|
First make sure you are allowed to POST to that ASP script from elsewhere. i.e. Copy the exact html code and post it locally to that ASP script. If it doesn't return the same 302 (returning a missing field or something instead), then take a look at -> http://www.devshed.com/Talk/Forums/Forum6/HTML/000387.html
For any of my script that use POST method, I always ensure they are posting from my site. Many people do this, too. So this disallows you from using LWP::UserAgent. |
|
#3
|
|||
|
|||
|
HI
I am allowed to POST to the ASP script, and i have permition to do this , however i need the re-direct. If i use the get method it follows the re-direct but the ASP is set up to accept vars from POSTed varibales ie a form , so i am using $req2 =POST 'http://www.xyz.com',[destAir =>'INN',depcode =>'ABZ']; etc. I have read up on the LWP module and it says: ------------------------------------- $ua->redirect_ok This method is called by request() before it tries to do any redirects. It should return a true value if a redirect is allowed to be performed. Subclasses might want to override this. The default implementation will return FALSE for POST request and TRUE for all others --------------------------------------- so i persume you have to overide the returning of FALSE for the POST request to TRUE , i dont know if this is correct, is there a way of overiding this ?? Really need some help going mad, so close yet so far Waseem ------------------ visit the next big thing in Information Technology http://www.itstop.com pre-register now Into sport ? goto http://www.sportwebpages.com |
|
#4
|
|||
|
|||
|
Just checked UserAgent.pm and found what you mentioned. I have never tried that but I would start with the following in addition to my script:
elsif ($res->RC_MOVED_TEMPORARILY) { my $referral = $req->clone; my $referral_uri = $res->header('Location'); local $URI::ABS_ALLOW_RELATIVE_SCHEME = 1; my $base = $res->base; $referral_uri = $HTTP::URI_CLASS->new($referral_uri, $base)->abs($base); my $response = $res->redirect_ok($referral); &output_status($response); } This code probably returns some errors since I haven't tested it. To debug it, I would print and see what all those returned variables ($base, $referral and all others) are. Right below the redirect_ok from UserAgent.pm, there is a way to check for looping as you can see, it's also an alternate way for you. |
|
#5
|
|||
|
|||
|
Hi
thansk for your help FreeeBSD , i got it to work somehow , but it works and that is all that matters. Waseem ------------------ visit the next big thing in Information Technology http://www.itstop.com pre-register now Into sport ? goto http://www.sportwebpages.com |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > 302 Header Error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|