Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Re: (Ovid) Re: Checking external links for inappropriate content

by vagnerr (Prior)
on Feb 15, 2002 at 15:44 UTC ( [id://145700]=note: print w/replies, xml ) Need Help??


in reply to Re: (Ovid) Re: Checking external links for inappropriate content
in thread Checking external links for inappropriate content

Something like this may help...
if ($res->is_success) { #Normal retrievel of content stuff }else{ #check for redirects if ($res->code() =~ /30[12]/){ #redirect codes (temp/perm) #grab the location my $remote_cgi = $res->header('Location'); { # Some servers erroneously return a relative URL for redirects, # so make it absolute if it not already is. local $URI::ABS_ALLOW_RELATIVE_SCHEME = 1; my $base = $res->base; $remote_cgi = $HTTP::URI_CLASS->new($remote_cgi,$base)->abs($ba +se); } }else{ # Request failed normaly, broken link }
Where $res is your result object

---If it doesn't fit use a bigger hammer
  • Comment on Re: Re: (Ovid) Re: Checking external links for inappropriate content
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://145700]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-20 15:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found