cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Cookies!!

From: rahul hampole <hampole_at_usc.edu>
Date: Wed, 26 Feb 2003 15:23:22 -0800

I dont quite follow you. I ran the curl request and recieved a file which has the first part similar to what I am supposed to get than there are calls to javascript functions which crash konqueror and galoen. My cookie jar file has session ID details. I really dont have any link to follow. I am using wget-1.8.2 which is the most recent version I think. The fundamental issue is how does the server figure out that the data it is sending me is being saved and hence starts sending javascript calls instead of the text i need. I attached the code I tried out so any suggestions and helpful hints are greatly apprecieated
Thanks
Rahul
-----code start here------------
#!/usr/bin/perl
system("rm -f ./cookies/amw");
system("curl -v -o \"/airlines/americawest.html\" -c \"/airlines/cookies/amw\" --dump-header headers -A \"Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)\" -L \"http://www.americawest.com/default.asp\"");
open(FILE,"americawest.html");
while($line=<FILE>){
        if($line=~m/<input name="ETD1" value="([^"]*)/i){
                $etd=$1;
        }
}
close(FILE);
local $param="";
system("rm -f americawest.html");
open(FILE,"./cookies/amw");
while($line=<FILE>){
        if($line=~m/(ASPSESSIONID[a-zA-Z]+)[\s]+([A-Za-z]+)/i){
                $param=$param."$1=$2&";
                }
        }
chop($param);
$stmt="curl -i -o \"/airlines/americawest.html\" -b \"$param\" -e \"http://www.americawest.com/homeIE.asp\" -A \"Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)\" -d \"SubmitForm=True&ETD1=$etd&priority-normal=cvgQuery.returnSlice.timeWindowTag&OriginNBA0=No&DestinationNBA0=No&NumFlights=10&NumYouths=0&NumInfants=0&NumInfants_Lap=0&Trip=RT&Origin=LAX,USA&Destination=BWI,USA&1stMonth_1=3&1stDay_1=8&1stTime_1=07:00&1stMonth_2=3&1stDay_2=15&1stTime_2=07:00&TicketType=COACH&NumAdults=1&NumSeniors=0&NumChildren=0&persons=&eCert=\" -L \"http://www.americawest.com/travelplanning/reservations/tp_selecttimes.asp\"";
print $stmt;
system($stmt);
---code ends here------

-------------------------------------------------------
This SF.net email is sponsored by: Scholarships for Techies!
Can't afford IT training? All 2003 ictp students receive scholarships.
Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp
Received on 2003-02-27