Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2011
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Use of cookies on a perl CGI

    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.

    mrdvd030
    Last edited by mrdvd030; 06-21-2011 at 10:41 AM.

  • #2
    New to the CF scene
    Join Date
    Feb 2011
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    One more thing: if I delete the cookie on my disk I got:

    response: HTTP::Response=HASH(0x24b51a8)

    Which is not better, though it might help to understand the problem.
    mrdvd030


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •