Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old March 7th, 2001, 06:16 AM
walshs walshs is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 112 walshs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Exclamation

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
__________________
World Cup Football (Soccer) Forums
http://www.todayinsoccer.com

Reply With Quote
  #2  
Old March 8th, 2001, 03:57 PM
mothra mothra is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 0 mothra User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > LWP:UserAgent anc Cookies


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway