Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old December 4th, 2000, 03:50 AM
walshs walshs is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 112 walshs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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

Reply With Quote
  #2  
Old December 4th, 2000, 06:14 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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.

Reply With Quote
  #3  
Old December 4th, 2000, 06:45 AM
walshs walshs is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 112 walshs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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

Reply With Quote
  #4  
Old December 4th, 2000, 07:46 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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.

Reply With Quote
  #5  
Old December 4th, 2000, 10:47 AM
walshs walshs is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 112 walshs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > 302 Header Error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway