[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

LWP and Redirect (for example: MOVE)

Posted on 2006-11-29
2
Medium Priority
?
353 Views
Last Modified: 2008-02-01
Hi,

When you sometimes get a page with LWP, it displays a MOVE message,
meaning that the page has been moved. Is it possible for LWP to then get the page on the new address?
i.e: Read and handle 301.

Greeting.
0
Comment
Question by:TonyJix
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Expert Comment

by:mjcoyne
ID: 18036088
It depends on whether the server provides that information in some manner.  You could check LWP for a 301 error, and branch based on whether it's true or not.  You could then process the page that was returned, looking for the new address.  But, this address might or might not be there, depending on how the server is configured and on what the admin has decided to send on connect to the old address.  Moreover, if the re-direct page does provide the new address, it could be anywhere on the page, and is not garunteed to be the only URL on the page...
0
 
LVL 84

Accepted Solution

by:
ozo earned 2000 total points
ID: 18036248
require LWP::UserAgent;
 
 my $ua = LWP::UserAgent->new;
 
 $ua->max_redirect( 7 );

 my $response = $ua->get('http://search.cpan.org/');
 
 if( $response->is_success ){
     print $response->content;  
 }else{
     die $response->status_line;
 }
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question