cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

help with curl POST with cookie

From: Tomas <mail2tomas_at_yahoo.com>
Date: Tue, 26 Feb 2008 04:06:41 -0800 (PST)

Hi,
I need some ideas from you please!
The website I used to check cheap flights have changed their booking system from cgi based to aspx, and with that it is not just a simple POST query, it appears I need to have a "cookie".

Data caputred with wireshark while trying to book a flight:
Hypertext Transfer Protocol
 POST /SkySales/FRSearchRedirect.aspx?culture=EN-GB HTTP/1.1
  Request Method: POST
  Request URI: /SkySales/FRSearchRedirect.aspx?culture=EN-GB
  Request Version: HTTP/1.1
 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
 Referer: http://www.ryanair.com/site/EN/
 Accept-Language: en-gb
 Content-Type: application/x-www-form-urlencoded
 Accept-Encoding: gzip, deflate
 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
 Host: www.bookryanair.com
 Content-Length: 264
 Connection: Keep-Alive
 Cache-Control: no-cache
 Cookie: WT_FPC=id=62.50.231.14-2356471872.29911443:lv=1204018317334:ss=1204018194423; ASP.NET_SessionId=regfu04fe332nuihir45bc2tyi45
Line-based text data: application/x-www-form-urlencoded
 travel_type=on&sector1_o=aSTN&sector1_d=KUN&sector_1_d=27&sector_1_m=042008&sector_2_d=00&sector_2_m=--&ADULT=1&CHILD=0&INFANT=0&mode=0&pT=1ADULT&oP=&rP=&nom=1&date1=20080427&date2=&m1=20080427aSTNKUN&m2=&m1DP=0&m1DO=0&m2DP=0&m2DO=0&pM=0&tc=1&module=SB&page=SELECT

I tried simply POST Line-based text data: application/x-www-form-urlencoded content to www.bookryanair.com/SkySales/FRSearchRedirect.aspx
function curl_ryanair()
{
$ch = curl_init();
/* curl set options */
curl_setopt($ch, CURLOPT_URL, "www.bookryanair.com/SkySales/FRSearchRedirect.aspx");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "travel_type=on&sector1_o=aSTN&sector1_d=KUN&sector_1_d=27&sector_1_m=042008&sector_2_d=00&sector_2_m=--&ADULT=1&CHILD=0&INFANT=0&mode=0&pT=1ADULT&oP=&rP=&nom=1&date1=20080427&date2=&m1=20080427aSTNKUN&m2=&m1DP=0&m1DO=0&m2DP=0&m2DO=0&pM=0&tc=1&module=SB&page=SELECT"

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
/* exec curl */
$data = curl_exec ($ch);
/* end curl session */
curl_close($ch);
return $data;
}

but I'm getting a message saying
Object moved to here.
How do I need to fix the script so when I do POST I'm actually posting with that cookie?

      ____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-02-26