Questions tagged [lwp]

The World-Wide Web library for Perl - LWP is a set of Perl modules which provides a simple and consistent application programming interface (API) to the World-Wide Web.

The main focus of the library is to provide classes and functions that allow you to write WWW clients. The library also contain modules that are of more general use and even classes that help you implement simple HTTP servers.

Most modules in this library provide an object oriented API. The user agent, requests sent and responses received from the WWW server are all represented by objects. This makes a simple and powerful interface to these services. The interface is easy to extend and customize for your own needs.

The main features of the library are:

  • Contains various reusable components (modules) that can be used separately or together.
  • Provides an object oriented model of HTTP-style communication. Within this framework we currently support access to http, https, gopher, ftp, news, file, and mailto resources.
  • Provides a full object oriented interface or a very simple procedural interface.
  • Supports the basic and digest authorization schemes.
  • Supports transparent redirect handling.
  • Supports access through proxy servers.
  • Provides parser for robots.txt files and a framework for constructing robots.
  • Supports parsing of HTML forms. Implements HTTP content negotiation algorithm that can be used both in protocol modules and in server scripts (like CGI scripts).
  • Supports HTTP cookies.
  • Some simple command line clients, for instance lwp-request and lwp-download.

More information on the CPAN website.

365 questions
0
votes
1 answer

Detect a broken link (web) in perl

I'm trying to detect if a link is broken or not, as in if it's a web address I could paste into my browser and find a web page. I've tried two methods so far that I found online and both are giving me false positives (LWP::UserAgent and…
Tyler
  • 509
  • 4
  • 11
  • 23
0
votes
1 answer

Perl LWP Curl Error: 'SSL peer certificate was not ok'

Here is my code: my $lwpcurl = LWP::Curl->new(CURLOPT_SSL_VERIFYHOST => 0,CURLOPT_SSL_VERIFYPEER=>0); my $content; $content = $lwpcurl->get($url); I am getting this error: `SSL peer certificate was not ok`
Miqdad Ali
  • 6,129
  • 7
  • 31
  • 50
0
votes
1 answer

PSGI, LWP::UserAgent & PayPal IPN

I have been trying for some time to get a simple PayPal IPN module working but keep getting a 400 Bad Request error from LWP::UserAgent. I am not sure why this is happening. PayPal pings me fine (I'm using the IPN simulator) and I can see the…
MadHacker
  • 608
  • 5
  • 18
0
votes
1 answer

Sending POST request with GET variables in URL (with LWP::UserAgent)

I have to make POST request to a URL which also contains GET variables (query string). I tried the following (which looks like a most simepl/logical way) but it does not work: my $ua = LWP::UserAgent->new; my $res =…
storyteller
  • 47
  • 1
  • 5
0
votes
3 answers

Got error using LWP

I was trying to use LWP in perl, and I followed the example given in the link:http://www.perl.com/pub/2002/08/20/perlandlwp.html, But I got errors as such: "www.google.com" is not exported by the LWP::Simple module Can't continue after import errors…
faz
  • 313
  • 5
  • 12
0
votes
2 answers

Print in multiple HTML files

I'm relatively new to Perl. I have a list of URLs from which I want to extract only the text and print it in different files. Here is a sample of my code : #!/usr/bin/perl -w use strict; use locale; use warnings; #use diagnostics; use…
Calvert42
  • 39
  • 4
0
votes
2 answers

LWP Send Post request and get headers only in response

I have code like this my $ua = new LWP::UserAgent; $ua->timeout($timeout); $ua->agent($useragent); $response = $ua->post($domain,['login_name'=>$login,'login_password'=> $password])->as_string; Content of page so large, thatI can't receive it. How…
Wolfgang
  • 254
  • 1
  • 5
  • 12
0
votes
1 answer

LWP::UserAgent, mod_perl causing large Apache error logs

Each time LWP::UserAgent or LWP::Simple is used with mod_perl (PerlRun), Ubuntu 10.04.4 and Apache 2.2.14 I get about 50 or so error messages in the Apache error log: Constant subroutine…
Onst
  • 15
  • 1
  • 3
0
votes
1 answer

$_POST is empty after requesting by POST lwp-request

I'm sending POST request from command line (Ubuntu): echo -n '{"prop":"value"}' | POST -c -U "application/json" http://site.com/test Server script outputs its $_POST: I see in output: Content-Length: 16, but in…
Larry Foobar
  • 11,092
  • 15
  • 56
  • 89
0
votes
1 answer

perl lwp form post

I'm trying to use LWP to post some content to a hosted service, over which I have no control, i.e. I must conform to their standards. Basically, the content must go over in a post which looks similar to the following: POST /…
Ben Carroll
  • 138
  • 2
  • 11
0
votes
2 answers

Downloading several files froma website with Perl

I began to mess around with the Web in Perl. I use Windows, and ActivePerl. I wrote a script, which downloads mp3 files (It's an archive of a radio talkshow, all legal, in case you're wondering :) ) It (in theory) parses a website collects all…
librarian
  • 129
  • 10
0
votes
3 answers

LWP::UserAgent set ip of requested url so LWP doesn't have to do dns lookup

I'm using LWP::UserAgent to request a lot of page content. I already know the ip of the urls I am requesting so I'd like to be able to specify the ip address of where the url I am requesting is hosted, so that LWP does not have to spend time doing a…
srchulo
  • 5,143
  • 4
  • 43
  • 72
0
votes
2 answers

How to access HTTP headers from a given url?

I am looking for a way to get http headers from a given url. I tried the below code but it is not working: #!/usr/bin/perl #use warnings; #use strict; use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $res = $ua->get("http://cpan.org"); print…
RanRag
  • 48,359
  • 38
  • 114
  • 167
0
votes
1 answer

Login to Way2sms through LWP failing

I am trying to login to Way2sms through LWP. The source code of the page says that the login form (which, in this case, appears to be the root node of everything within the body) has an action attribute of '', which I read in some other…
SexyBeast
  • 7,913
  • 28
  • 108
  • 196
0
votes
1 answer

Perl: test if remote file exists http

Hello Everyone! I need to test if a remote file on a http server exists without downloading it. I looked into various command line programs like wget, curl, axel, but could not find a test-only flag. I am working in an production environment and…
juettemann
  • 323
  • 2
  • 14