perl code that requests a url and prints redirects
$30-100 USD
Concluído
Publicado há aproximadamente 14 anos
$30-100 USD
Pago na entrega
I need some perl code that can take a LWP::UserAgent object
and do a request on an HTTP::Request object, and if the request encounters HTTP redirect headers that the user-agent follows, it should print out each of the URLs that the user-agent is redirected to. For example:
my $ua = LWP::UserAgent
my $request = HTTP::Request->new('GET', '[login to view URL]');
# your code goes here
Then the page
<[login to view URL]>
redirects to
[login to view URL]
and that page redirects to
[login to view URL]
So the code should output something like:
redirected to <[login to view URL]>
redirected to [login to view URL]
In other words, if there's more than one redirect (this example has two), the code should output each redirect, not just the last one.
I think this can be done with a "callback" function or something, but I can't find how to do it.
This is probably a really simple problem (the solution is probably only about two or three lines of code) so you can either submit a bid, or if you want you can even submit a solution as a comment and I'll send you a tip of it works, since it's such a small job.
## Deliverables
Basically as described above.
## Platform
It's probably not a platform-dependent thing, but it has to work for me on Perl 5.8.8 with CentOS 5.4.