on 9/5/02 11:19 AM, [EMAIL PROTECTED] purportedly said:

> i am trying to post some information to a search page to retrive the
> result. The problem is that to reach the search page i must first pass
> by the "welcome page", if i directly go to the search page i am
> redirected to the welcome page, its an <a> tag that i take from the
> welcome page to go to the search page and there is no variable in it, so
> there is certainly a cookie that is used to keep my session alive. i had
> try many thing that looks like this:
> 
> my $ua = LWP::UserAgent->new(keep_alive => 1);
> $cookies_file = HTTP::Cookies->new(file =>
> "/home/jonathan/.mozilla/jonathan/g8ofozx9.slt/cookies.txt");
> $ua->cookie_jar($cookies_file);
> $ua->request(GET $welcome_page);
> $response = $ua->request(GET $search_page);
> 
> but i always get the welome page.

Actually, there are three possibilities. One is a required cookie set by the
welcome page, two is a referer check, and three is a browser check.

Print out the full response with headers to see if cookies are being set.
You don't need to bind your cookies to a file, and I don't recommend it
unless you *really* need to save cookies outside of the script scope. In any
case, I wouldn't use a browser cookie file, especially Mozilla. Make one of
your own.

Set the UserAgent to an actual browser, so the server thinks you're legit.
Watch out of javascript, as it can do things (such as set cookies and alter
URL parameters) that LWP doesn't know about.

Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"

Reply via email to