|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Hi
I am writing a perl script to track tranactions using a specific shopping cart, the problem is i using LWP::UserAgent to grab the pages and then grab the value of the cart before payment (this is a simple text processign thing) But if i use the normal site without (LWP) a cookie is set, for the shopping cart. But when i use LWP to goto the same page as the code shows below, no cookie is set thus no items enter the shopping cart . How can i "grab" the cookies from the header when i print out the html from the LWP request i can see the set-cookie command but no cookie is set. I have tried varuious things but i think i may be going along the worng path. ----------------------------------------------------------- use CGI qw(:standard escapeHTML); use LWP::Simple; use HTTP::Request::Common qw(POST); use HTTP::Request::Common qw(GET); use LWP::UserAgent; use HTTP::Cookies; $pr = param('PRODREF'); $r = param('RANDOM'); $path =param('PATH'); $page = param('PAGE'); $sec = param('SECTION_BLOB'); $ref = param('REFPAGE'); $pq = param('PREVQUERY'); $url = "http://xyz.com/cgibin/xyz.pl"; $ua_l = LWP::UserAgent->new(); $req_l = POST $url,[PRODREF =>$pr,RANDOM=>$r,PATH=>$path,PAGE=>$page,SECTION_BLOB=>$sec]; $content_l = $ua_l ->request($req_l)->as_string; print $content_l; ------------------------------------------------------------ Regards WASEEM |
|
#2
|
|||
|
|||
|
Hello,
By default the LWP module does not accept cookies. you need to add $ua = LWP::UserAgent->new; $ua->cookie_jar(HTTP::Cookies->new(file => "c:/temp/lwpcookies.txt", autosave => 1)); To your code to use cookies |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > LWP:UserAgent anc Cookies |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|