LWP::Simple and Cookies not working

Discussion in 'Perl Misc' started by Dan, Dec 23, 2003.

  1. Dan

    Dan Guest

    I have a script that does a search of completed Ebay auctions for
    certain items. All was fine until a few weeks ago, when Ebay changed it
    so that one must login in order to search completed items. I've modified
    the script to support cookies for the login information after searching
    on deja. The script seems fairly simple, but the get() statement returns
    a page that claims that the browser does not support cookies. I can't
    see what I'm missing here :(

    Code follows. You'll need a valid Ebay USerID and password to test it.
    Thanks in advance.

    -Dan

    # !/user/bin/perl

    use LWP::Simple qw ($ua get);
    use HTTP::Cookies;

    $ua->cookie_jar(HTTP::Cookies->new);

    # Modify the following as needed.

    $Login = "login";
    $Password = "password";

    $URL="http://signin.ebay.com/aw-cgi/eBayISAPI.dll?MfcISAPICommand=SignInWelcome&siteid=0&co_partnerId=2&UsingSSL=0&pp=&pa1=&pa2=&pa3=&il=-1&pageType=1637&userid="
    .. $Login . "&pass=" . $Password .
    "&keepMeSignInOption=1&ru=http://search-completed.ebay.com:80/search/search.dll?GetResult&catref=C3&category1=1049&sr=0&query=craaft&lotr=1&completedonly=1&from=R2";

    $content = get $URL;

    open (TMPOUT, ">ebaytest.out");

    print TMPOUT $content;

    close TMPOUT;
    Dan, Dec 23, 2003
    #1
    1. Advertising

  2. Dan

    Matt Garrish Guest

    "Dan" <> wrote in message
    news:pv3Gb.120414$8y1.373415@attbi_s52...
    > I have a script that does a search of completed Ebay auctions for
    > certain items. All was fine until a few weeks ago, when Ebay changed it
    > so that one must login in order to search completed items. I've modified
    > the script to support cookies for the login information after searching
    > on deja. The script seems fairly simple, but the get() statement returns
    > a page that claims that the browser does not support cookies. I can't
    > see what I'm missing here :(
    >


    By default $ua will identify itself as the libwww version you are using.
    There's nothing stopping you from telling the server you're something else:

    $ua->agent('Mozilla/5.0');

    (untested, however, as I have no interest in ebay... : )

    Matt
    Matt Garrish, Dec 23, 2003
    #2
    1. Advertising

  3. In article <Pv3Gb.120414$8y1.373415@attbi_s52>,
    Dan <> wrote:
    >...
    >
    >use LWP::Simple qw ($ua get);
    >use HTTP::Cookies;
    >
    >$ua->cookie_jar(HTTP::Cookies->new);
    >
    ># Modify the following as needed.
    >
    >$Login = "login";
    >$Password = "password";
    >
    >$URL="http://signin.ebay.com/aw-cgi/eBayISAPI.dll?MfcISAPICommand=SignInWelcome&siteid=0&co_partnerId=2&UsingSSL=0&pp=&pa1=&pa2=&pa3=&il=-1&pageType=1637&userid="
    >. $Login . "&pass=" . $Password .
    >"&keepMeSignInOption=1&ru=http://search-completed.ebay.com:80/search/search.dll?GetResult&amp;catref=C3&amp;category1=1049&amp;sr=0&amp;query=craaft&amp;lotr=1&amp;completedonly=1&amp;from=R2";
    >
    >$content = get $URL;
    >
    >open (TMPOUT, ">ebaytest.out");
    >
    >print TMPOUT $content;
    >
    >close TMPOUT;
    >


    Sorry, I've never gone near Ebay..

    May not help but have you done any sleuthing with debug settings:

    use LWP::Debug qw(+);

    Another longshot but you can peek into the cookie jar too:

    my $jar = HTTP::Cookies->new(...);
    ...
    print $jar->as_string if $DEBUG;

    --
    Charles DeRykus
    Charles DeRykus, Dec 30, 2003
    #3
  4. Dan

    Brian Wakem Guest

    EvilOverlord wrote:

    > Hi,
    >
    > Did you ever find a solution to this problem?
    >
    > I ran into exactly the same problem today trying to write very much the
    > same perl script as yours.
    >
    > Enabling debug and examining the cookie shows that it seems to have been
    > accepted OK. Ebay simply thinks otherwise. I have also changed the user
    > agent with no luck either.
    >
    > I really don't know why eBay are so determined to stop me doing a simple
    > completed items search.



    Who are you talking to?

    Don't re-invent the wheel -
    http://search.cpan.org/search?query=ebay&mode=module


    --
    Brian Wakem
    Email: http://homepage.ntlworld.com/b.wakem/myemail.png
    Brian Wakem, Aug 19, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hal Vaughan

    Not getting cookies in LWP

    Hal Vaughan, Mar 5, 2004, in forum: Perl
    Replies:
    1
    Views:
    584
    Erik de Mare
    Mar 7, 2004
  2. _Who
    Replies:
    7
    Views:
    2,630
  3. Larry Snider

    LWP::Simple Not Working

    Larry Snider, Dec 30, 2003, in forum: Perl Misc
    Replies:
    20
    Views:
    298
    Matt Garrish
    Jan 4, 2004
  4. Perl Mon
    Replies:
    4
    Views:
    219
    Perl Mon
    Jan 11, 2005
  5. emrefan
    Replies:
    6
    Views:
    336
    Peter J. Holzer
    Jun 16, 2008
Loading...

Share This Page