I want to grab a bit of information from IMDB.
I can do this with LWP::UA by with something like this:
my $ua = LWP::UserAgent->new; my $response = $ua->get('http://imdb.com/find?nm=on;mx=20;q=eliza%20dushku');
and if I do that with a name that exactly matches something in IMDB's database, it will redirect the browser to another URL, in this case http://imdb.com/name/nm0244630/
Now I can parse the information in that page to get what I want, but actually, all I need is this person's IMDB URL, so if I could figure out whether their server returned a Location: header which send the browser to this URL, that would save unneccessary processing.
If this doesn't happen of course, (and the URL remains "http://imdb.com/find?nm=on;mx=20;q=liza%20dushku" because you got her name wrong) I need to do some further processing. But what I really want is something like this pseudocode:
Any ideas?my $response = $ua->get('http://imdb.com/find?nm=on;mx=20;q=eliza%20dushku'); if($response included a relocation to a URL){ store that URL } else { do the more complicated stuff }
($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss')
=~y~b-v~a-z~s; print
In reply to How to tell if a URL returned a Location: header? by Cody Pendant
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |