Easy A
Would you like to react to this message? Create an account in a few clicks or log in to continue.


 
HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log inLog in  

Share
 

 Use of cookies on a perl CGI

View previous topic View next topic Go down 
AuthorMessage
Notch
Member
Member
Notch

Posts : 9
Join date : 2011-05-19

Use of cookies on a perl CGI Empty
PostSubject: Use of cookies on a perl CGI   Use of cookies on a perl CGI EmptyThu Jun 23, 2011 7:34 am

Hi,
I am trying to download a text file from a URL:

http://modbase.compbio.ucsf.edu/modb...abaseID=P21812

There is a tutorial for this service:

http://modbase.compbio.ucsf.edu/modb....html#retrieve

That basically says that I should use cookies in order to be able to
retrieve my text file from the URL.

So I did this:

my $url = "http://salilab.or/modbase/retrieve/modbase?databaseID=P21812";

my $browser = LWP::UserAgent->new;

use HTTP::Cookies;
my $cookie_jar = HTTP::Cookies->new(
'file' => '/home/mrdvd030/.cookies/cookies.lwp',
# where to read/write cookies
'autosave' => 1,
# save it to disk when done
);
$browser->cookie_jar( $cookie_jar);

my $response = $browser->get( "http://salilab.or/modbase/retrieve/modbase?databaseID=P21812", ':content_file' => "/home/mrdvd030/test");

print "response: " . $response;

In /home/mrdvd030/.cookies/ I put a text file called cookies.lwp that contains the following text:
modbase.compbio.ucsf.edu FALSE / FALSE 2116975226 modbase-academic modbase_user&anonymous&modbase_passwd&anonymous

I then executed my code, and here what I get:

teste: /home/mrdvd030/.cookies/cookies.lwp does not seem to contain cookies at /usr/share/perl5/HTTP/Cookies.pm line 432, <FILE> line 1.

If I look up in my cookie, contain has now change and is:

#LWP-Cookies-1.0


What is wrong in my proceedure? Any help would be appreciated.
Back to top Go down
 

Use of cookies on a perl CGI

View previous topic View next topic Back to top 
Page 1 of 1

 Similar topics

-
» Using regular expression in perl

Permissions in this forum:You cannot reply to topics in this forum
Easy A :: Use of cookies on a perl CGI Edit-trash Useless :: Trash-