zby gellyfish,
Thanks for the insights. Not quite there yet. I think it boils down to the way I'm using the required cookie. Here's the code again:
1:use LWP::Simple;
2:use LWP::UserAgent;
3:use HTTP::Request::Common qw(POST);
4:use HTTP::Request::Common qw(GET);
5:use HTTP::Cookies;
6:$url = 'http://www.biocarta.com/search/gene.asp?';
7:my $request = POST "$url",
8:[
9:ID1 => 48852,
10:]
11:my $ua = LWP::UserAgent->new;
12:my $response = $ua->request($request);
13:print $response->as_string;
14:'Okay. Let's set up a cookie jar, and extract the cookie
15:my $cjar = HTTP::Cookies->new(file => 'cookies.txt',
autosave => 1);
16:$cjar->extract_cookies($response);
17:'As per your suggestions
18:my $req2 = GET "$url";
19:$cjar->add_cookie_header($req2);
20:$ua->redirect_ok($req2);
21:$response2 = $ua->request($req2);
22:print $response2->as_string;
As is it, it returns the genesrchresults.asp webpage, but without the search results (before, it returned undef). If I use $request on line 21 instead of $req2 it returns a 'Doh! page cannot be displayed error blah blah'
Any more ideas?
pDuffy.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.