develooper Front page | perl.libwww | Postings from December 2001

Re Re: Help please !! ASAP !

From:
Deepak Adinarayana
Date:
December 27, 2001 19:53
Subject:
Re Re: Help please !! ASAP !
Message ID:
20011228035336.31822.qmail@mailFA9.rediffmail.com

Hi,



Thanks a lot.This seems to work for the main page which has the URL :

http://groups.yahoo.com/group/dini/messages/1?threaded=1



but does not seem to work for the URLs within the page like:



http://groups.yahoo.com/group/dini/message/3?threaded=1

http://groups.yahoo.com/group/dini/message/14?threaded=1



It still gives me the same error saying that my browser is not accepting their cookies.Please do suggest accordingly regarding any other alternatives.



My script presently looks like this:

#!/usr/bin/perl

use strict;

use LWP::UserAgent;

use HTTP::Cookies;

use HTML::Parse;

my $ua = new LWP::UserAgent;

my $cookie_jar = HTTP::Cookies->new;

$ua->cookie_jar($cookie_jar);

my $url = 'http://groups.yahoo.com/group/dini/message/3?threaded=1';

my $file = 'tryfile';

my $request = HTTP::Request->new ('GET' => $url);

$request->header('Accept' => 'text/html,text/plain,*/*');

my $response;

my $response = $ua->request($request);

open (FILE,">$file") or die "\n Error opening $file: $!";

print FILE $response->content;

close FILE;

exit;



Thanks in advance,

Deepak.



On Wed, 26 Dec 2001 Francis Turner wrote :

> Deepak Adinarayana wrote:

> 

> > <snip>

> > Here is my code.Please suggest ways to make it work.

> > 

> > my $ua = new LWP::UserAgent;

> > my $cookie_jar = HTTP::Cookies->new;

> 

> Add this line here

> $ua->cookie_jar($cookie_jar);

> 

> 

> > my $url = 'http://groups.yahoo.com/group/dini/message/-

> 1452?threaded=1';

> > my $file = 'tryfile';

> > my $request = new HTTP::Request ('GET' => $url);

> > 

> 

> # you should not need this line below

> 

> 

> > $cookie_jar->add_cookie_header($request);

> > 

> > $request->header('Accept' => 'text/html');

> > $request->header('Accept' => 'text/plain');

> > 

> > my $response;

> > my $response = $ua->request($request,$file);

> > 

> 

> #you should not need this line below

> 

> 

> > $cookie_jar->extract_cookies($response);

> > 

> > Thanks in advance,

> > Deepak. 

> > 

> > 

> > 

> 

> 

> 

> -- 

> Francis Turner, CIO Juelich Enzyme Products GmbH

> http://www.juelich-enzyme.com/ +49-173-291-7278

> 

> If you're not part of the solution, you're part of the 

> precipitate.

>              -- Henry J. Tillman

> 

> 

 




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About