LWP::Simple and Cookies not working

D

Dan

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/eBayI...p=&pa1=&pa2=&pa3=&il=-1&pageType=1637&userid="
.. $Login . "&pass=" . $Password .
"&keepMeSignInOption=1&ru=http://search-completed.ebay.com:80...ft&lotr=1&completedonly=1&from=R2";

$content = get $URL;

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

print TMPOUT $content;

close TMPOUT;
 
M

Matt Garrish

Dan said:
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
 
C

Charles DeRykus

...

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/eBayI...p=&pa1=&pa2=&pa3=&il=-1&pageType=1637&userid="
. $Login . "&pass=" . $Password .
"&keepMeSignInOption=1&ru=http://search-completed.ebay.com:80...ft&lotr=1&completedonly=1&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;
 
B

Brian Wakem

EvilOverlord said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,829
Latest member
PIXThurman

Latest Threads

Top