Radek_1
-
Posts
3 -
Joined
-
Last visited
Posts posted by Radek_1
-
-
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?
-
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.
Problem with Curl library, probably something happens in javascript?
in PHP Coding Help
Posted
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).
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