On 10 February 2010 17:01, Mike Blezien <mick...@frontiernet.net> wrote: > > ----- Original Message ----- From: "Dermot" <paik...@googlemail.com> > To: "Perl List" <beginners@perl.org> > Sent: Wednesday, February 10, 2010 10:14 AM > Subject: Re: LWP error returned > > > On 10 February 2010 15:47, Mike Blezien <mick...@frontiernet.net> wrote: >> >> Hello, >> >> I've run into an error while using the LWP module which I haven't come >> accross before and was wondering what is means. This is the coding I'm >> using: >> >> >> ---------------------------------------------------------------------------------------------------------- >> use LWP::UserAgent; >> >> my $USERNAME = "XXXXXX"; >> my $PASSWORD = "XXXXXX"; >> >> my $URL = >> >> "http://technet.rapaport.com/HTTP/RapLink/download.aspx?Polish=I,EX,VG,G,F,P&Symm=I,EX,VG,G,F,P&SortBy=owner&White=1&Fancy=1&Programmatically=yes"; >> my $URL = >> >> qq~https://technet.rapaport.com/HTTP/RapLink/download.aspx?Shape=B&CaratSizeFrom=0.4&CaratSizeTo=3.5&ColorFrom=D&ColorTo=J&ClarityFrom=FL&ClarityTo=SI1&CutFrom=I&CutTo=G&GradeReport=GIA,AGS&Polish=I,EX,VG,G&Symmetry=I,EX,VG,G&FluorescenceIntensity=N,VSL,F,M,S&SellerLogin=67155,60745,32235,39321,43460,28426,43412,67000,68708,50841s~; >> >> my $ua = LWP::UserAgent->new(); >> $ua->timeout(60); >> #create request >> my $req = new HTTP::Request 'POST' => $URL; >> $req->content_type("application/x-www-form-urlencoded"); >> >> #add creadentials to request >> $req->authorization_basic($USERNAME,$PASSWORD); >> my $res = $ua->request($req); >> >> my $content = $res->content(); >> >> ------------------------------------------------------------------- >> >> The error/content is returns is "Length Required" .... not exactly sure >> what >> that means. > >> A pure guess would be that the host requires a 'content-length' header >> OR the web service requires a length parameter. > > > Is there something else I need to add to the coding the to pass this > parameter ??
I doubt that it is the HTTP header that it's after but the docs for setting HTTP headers with LWP are here. http://search.cpan.org/~gaas/libwww-perl-5.834/lib/HTTP/Headers.pm I suspect you will need to add a parameter to your url ...&SortBy=owner&White=1&Programmatically=yes&length=n but you will need to get more details from the web-service before you can be sure what format the length should be in and what it refers to. Good luck, Dp. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/