Jump to content

Radek_1

New Members
  • Posts

    3
  • Joined

  • Last visited

Radek_1's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello, I want to download flight from Wizzair page. I've checked all headers which are sended when browser "create" request (the same which Ryanair few months ago). It looks like this in my browser: I'm entering at https://wizzair.com/pl-PL/Search, select everything (from-to, date arrival and departure) then click "Send" and I've got results. I've checked headers and I can see, that theres two requests to the following pages: 1) Search (here is created session ID saved in cookie, i've also sent POST parameters here), it returns error 302 then redirect to: 2) Select (theres no any post or get parameters, just requested session ID created before) and return results with flights. I was trying to achieve the same results by curl. I created curl request with the same POST parameters to Search page. I save sessionId to cookie, also create the same cookies as in browser. Then enter to Select page, use cookies saved before but nothing happens. First request return 302 error (the same happen in brower) Second request returns default Wizzair website without flight results If I use sessionId generated in my browser (not from curl request), second request show me correct results. Why it doesn't work in curl? Is there any request processed and saved JavaScript which is not processed by curl method? Code from my first requst where i'm sending post parameters in request $fields = array( 'cookiePolicyDismissed' => 'true', '__EVENTTARGET' => 'HeaderControlGroupRibbonSelectView_AvailabilitySearchInputRibbonSelectView_ButtonSubmit', '__VIEWSTATE' => '/wEPDwUBMGQYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgEFXEhlYWRlckNvbnRyb2xHcm91cFJpYmJvblNlbGVjdFZpZXckQXZhaWxhYmlsaXR5U2VhcmNoSW5wdXRSaWJib25TZWxlY3RWaWV3JFN0dWRldFNlbmlvckdyb3VwwAw35gayQedhYJ8oz+CHlR8x2gWGvNOEfHfCOBjF/lk=', 'cff49415-63b6-4d31-b273-5eab61b6c327' => 'e2df7ef6-3abf-4eab-8110-51c30f30109a', 'HeaderControlGroupRibbonSelectView%24AvailabilitySearchInputRibbonSelectView%24OriginStation' => $from, 'HeaderControlGroupRibbonSelectView%24AvailabilitySearchInputRibbonSelectView%24DestinationStation' => $to, 'HeaderControlGroupRibbonSelectView%24AvailabilitySearchInputRibbonSelectView%24DepartureDate' => $dateStart, 'HeaderControlGroupRibbonSelectView%24AvailabilitySearchInputRibbonSelectView%24ReturnDate' => $dateBack, 'HeaderControlGroupRibbonSelectView%24AvailabilitySearchInputRibbonSelectView%24PaxCountADT' => '1', 'HeaderControlGroupRibbonSelectView%24AvailabilitySearchInputRibbonSelectView%24PaxCountCHD' => '0', 'HeaderControlGroupRibbonSelectView%24AvailabilitySearchInputRibbonSelectView%24PaxCountINFANT' => '0', 'WizzSummaryDisplaySelectViewRibbonSelectView%24PaymentCurrencySelector' => '00000000-0000-0000-0000-000000000000FULL', 'HeaderControlGroupRibbonSelectView%24AvailabilitySearchInputRibbonSelectView%24ButtonSubmit' => 'Szukaj'); //url-ify the data for the POST foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string,'&'); //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0'); curl_setopt($ch, CURLOPT_HEADER,1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE_FILE); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Host: wizzair.com', 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/*;q=0.8', 'Accept-Language: pl,en;q=0.7,en-us;q=0.3', 'Connection: keep-alive' )); curl_setopt($ch,CURLOPT_POST,count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string); //execute post $result = curl_exec($ch); curl_close($ch);
  2. josh, thank you for your answser. I've tired things you suggested but nothing happen I've turn on CURLOPT_FOLLOWLOCATION and also turn off CURLOPT_SSL_VERIFYPEER but still it's give me same results. COOKIE_FILE is definied at the beginning of the file define("COOKIE_FILE", "cookie.txt"); Any other ideas how I can make it works?
  3. Hello, I wanted to download flight from Ryanair page. I've checked all headers which are sended when browser "create" request. It looks like this: I'm entering at https://www.bookryanair.com/SkySales/Booking.aspx In headers I can see, that theres two GET requests to the following pages: 1) Booking.aspx (here is created session ID) 2) Search.aspx (here is generated and assigned _VIEWSTATE as hidden field in form) Until now, everything what I'm trying to do by curl is the same as in browser (responses are the same). Now I'm complete form and data are sended by POST to: 3) Search.aspx It uses the above mentioned SessionID and _VIEWSTATE, the rest of the fields I fill as in request from the browser. In browser I can see flights, while when I'm trying to generate it by curl, I have the same result as in first GET reuqest to Search.aspx (2) (no data about flight, like empty requets). Code from my last request to Search.aspx (3): $url = "https://www.bookryanair.com/SkySales/Search.aspx"; $fields = array( '_EVENTTARGET' => 'SearchInput$ButtonSubmit', '_EVENTARGUMENT' => '', '_VIEWSTATE' => $viewstate, 'formaction' => 'Search.aspx', 'errorlist' => '', 'SearchInput$IsFlexible' => 'on', 'SearchInput$TripType' => 'RoundTrip', 'SearchInput$Orig' => 'WMI', 'SearchInput$Dest' => 'NYO', 'SearchInput$DeptDate' => '06/05/2014', 'SearchInput$RetDate' => '10/05/2014', 'SearchInput$PaxTypeADT' => '1', 'SearchInput$PaxTypeCHD' => '0', 'SearchInput$PaxTypeINFANT' => '0'); foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string,'&'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Accept: text/html, */*; q=0.01', 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8', 'Connection: keep-alive', 'Cache-Control: no-cache', 'Pragma: no-cache', 'X-Requested-With: XMLHttpRequest' )); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0'); curl_setopt($ch, CURLOPT_HEADER,1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0); curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIE_FILE); curl_setopt($ch, CURLOPT_REFERER, 'https://www.bookryanair.com/SkySales/Booking.aspx'); curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE_FILE); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS,$fields_string); $result = curl_exec($ch); curl_close($ch) $viewstate is from request to Search.aspx (2) and retrieved from the hidden field generated _VIEWSTATE. Cookie_file - place with stored cookie.txt and sessionId. What am I doing wrong? Is the problem in the communication that uses https protocol? Thanks in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.