lwp-useragent

Why don't I get a defined value from LWP::UserAgent->new()?

I get this error while using cookie_jar method: Can't call method cookie_jar on an undefined value Here is my code: my $cookie_jar= new HTTP::Cookies; my $ua=new LWP::UserAgent; my %cookies= fetch CGI::Cookie; my $encoded=$cookies{'SCred'}; $cookie_jar->set_cookie(1, "SCred", $encoded, "/", $SSO_DOMAIN, "", 0, 0, 60*60, 0); $ua->co...

making LWP Useragent faster

I need to perform a large number of HTTP post requests, and ignore the response. I am currently doing this using LWP::UserAgent. It seems to run somewhat slow though I am not sure if it is waiting for a response or what, is there anyway to speed it up and possibly just ignore the responses? ...

Why don't my LWP::UserAgent credentials work?

I'm trying to access a protected file. Server is using digest authentication - which I can see from the printed out response. Here is the sample code: use LWP; use strict; my $url = 'http://somesite.com/aa/bb/cc.html'; my $username = 'scott'; my $password = 'tiger'; my $browser = LWP::UserAgent->new('Mozilla'); $browser->credentials("...

Is LWP::UserAgent not thread-safe?

I'm running 40-or-so threads with the following subroutine: my $app = shift; my $ua = LWP::UserAgent->new(); $ua->timeout(5); my $response = $ua->get($$app{'watch_url'}); my $new_md5; if ($response->is_success()) { $new_md5 = md5_hex($response->content()); } return ($$app{'short_name'}, $$app{'watch_md5'}, $new_md5); Core dumps en...

How can I get the body of an HTTP response using LWP::UserAgent in Perl?

I find that the return from LWP::UserAgent->request() contains both the header and body of a HTTP response. I just need the body of the response to do some parsing, so how can I do? ...

Suppressing "Day too big" warning in Perl LWP::UserAgent

I have a fairly simple perl script with uses the LWP::UserAgent module to follow URLs through redirection to find the final destination URL which it then stores in our MySQL database. The problem is that from time to time the script reports warnings that look like this: Day too big - 25592 > 24855 Sec too small - 25592 < 74752 Sec too ...

How can I make LWP::UserAgent appear to have Flash installed?

I have a Perl script that uses LWP::UserAgent to download a webpage which it then processes using regular expressions. The problem is that portions of the webpage which are regular HTML aren't being returned to LWP::UserAgent since the site recognizes that the browser doesn't have Flash installed and instead returns HTML prompting us to ...

How do I process the response as a file without using the :content_file option?

Example code: my $ua = LWP::UserAgent->new; my $response = $ua->get('http://example.com/file.zip'); if ($response->is_success) { # get the filehandle for $response->content # and process the data } else { die $response->status_line } I need to open the content as a file without prior saving it to the disk. How would you do ...

What is this Perl code using LWP::UserAgent doing?

i have this code : use strict; use LWP::UserAgent; use warnings; my $ua = new LWP::UserAgent(agent => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5'); $ua->proxy([qw(http https)] => 'http://59.39.92.148:1080'); my $response = $ua->get("http://www.google.com"); print $response->code,' '...

Clone request headers in Vanilla Perl CGI to LWP UserAgent

I have a perl CGI application that I want to take the users request headers, and turn those around into an LWP::UserAgent get request. Basically the goal is to replicate the incoming users headers and use those to make a separate request. I've tried to create the headers myself but when I attempt to display the CGI headers and then my ...

How can I fetch the same URL with different query string with Perl's LWP::UserAgent?

I looked up articles about using LWP however I am still lost! On this site we find a list of many schools; see the overview-page and follow some of the links and get some result pages: I want to parse the sites using LWP::UserAgent and for the parsing : want to use either HTML::TreeBuilder::XPath or HTML::TokeParser At the moment I am ...

How can I use Perl's LWP::UserAgent to fetch the same URL with different query strings?

I have a running LWP::UserAgent that should be applied on following URL: http://dms-schule.bildung.hessen.de/suchen/suche_schul_db.html?show_school=5503 This runs with many many similar targets see the following endings: html?show_school=5503 html?show_school=9002 html?show_school=5512 I want to do this with use LWP::UserAgent: fo...