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


help with curl POST with cookie

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

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/, application/, application/msword, */*
 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)
 Content-Length: 264
 Connection: Keep-Alive
 Cache-Control: no-cache
 Cookie: WT_FPC=id=; ASP.NET_SessionId=regfu04fe332nuihir45bc2tyi45
Line-based text data: application/x-www-form-urlencoded

I tried simply POST Line-based text data: application/x-www-form-urlencoded content to
function curl_ryanair()
$ch = curl_init();
/* curl set options */
curl_setopt($ch, CURLOPT_URL, "");
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 */
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.

Received on 2008-02-26