I need to probably modify my cURL request to make it work. You can find the needed url from searching on Qantas for example (Melbourne to Sydney, one way, the next day flights), you get a page with the results. Then if you mouseover the flight number, you get a dialogue box. In FF network, you can see a get request happen as you mouseover which retrieves a json document.
The cURL code that does not work:
$flight_data_url = 'http://book.qantas.com.au/pl/QFOnline/wds/FlifoInfoServlet;jsessionid=eFVNx9ORnACoaRyRp_Iu675LrmM6JfRkDHpa2c6I60bhJABPBeW3!764143094!1637886517!1440118985617?AIRLINE_CODE=QF&B_DATE=201508220600&B_LOCATION=MEL&E_LOCATION=SYD&FLIGHT_NUMBER=400&LANGUAGE=GB&SITE=QFQFQFBD'
$handle = curl_init();
$options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CAINFO => $path . '\cacert.pem',
CURLOPT_URL => $flight_data_url,
CURLOPT_HTTPHEADER => array('Host'=>'book.qantas.com.au','User-Agent'=>'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)','Accept'=>'application/json, text/javascript, */*; q=0.01','Accept-Language'=>'en-US,en;q=0.5','Accept-Encoding'=>'gzip, deflate','Content-Type'=>'text/javascript; charset=utf-8','X-Requested-With'=>'XMLHttpRequest','Referer'=>'http://book.qantas.com.au/pl/QFOnline/wds/OverrideServlet','Cookie'=>$flight_cookie_file,'Connection'=>'keep-alive')
);
curl_setopt_array($handle, $options);
$flight_model_data = curl_exec($handle);
curl_close($handle);
The python code that does work:
#!/usr/bin/env python
import requests
def getaurl():
url = 'http://book.qantas.com.au/pl/QFOnline/wds/FlifoInfoServlet;jsessionid=LuJYL8OJHk_DUIPcYbcfT343gYMEw3b9ej4Vt_MATLerQG0kNIZR!932397328!976639289!1440293569417?AIRLINE_CODE=QF&B_DATE=201508240630&B_LOCATION=MEL&E_LOCATION=SYD&FLIGHT_NUMBER=404&LANGUAGE=GB&SITE=QFQFQFBD'
headers = { "Host":"book.qantas.com.au",'user-agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0', "Accept":"application/json, text/javascript, */*; q=0.01", "Accept-Language":"en-US,en;q=0.5", "Accept-Encoding":"gzip, deflate","Content-Type":"text/javascript; charset=utf-8", "X-Requested-With":"XMLHttpRequest", "Referer":"http://book.qantas.com.au/pl/QFOnline/wds/OverrideServlet", "Connection":"keep-alive" }
r = requests.get(url, headers=headers)
print r.text
getaurl()