Need help with ssl curl - flight schedule

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
taufikhdyt
Forum Newbie
Posts: 2
Joined: Thu Dec 23, 2010 7:49 am

Need help with ssl curl - flight schedule

Post by taufikhdyt »

I need help to get flight schedule from http://www.sriwijayaair.co.id/id but always error using curl to access ssl.

here are my code:

<?php
$headers = array(
"User-Agent=Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 GTB7.1 (.NET CLR 3.5.30729)",
"Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language=en-us,en;q=0.5",
"Accept-Encoding=gzip,deflate",
"Accept-Charset=ISO-8859-1,utf-8;q=0.7,*;q=0.7",
"Keep-Alive=1150",
"Connection=keep-alive",
"Referer=http://www.sriwijayaair.co.id/id",
"Cookie=language=in; location=id; dest=home; __utma=260465999.1394002812.1293106375.1293106375.1293106375.1; __utmb=260465999.1.10.1293106375; __utmc=260465999; __utmz=260465999.1293106375.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)",
"Content-Type=application/x-www-form-urlencoded",
"Content-Length=121",
"POSTDATA=isReturn=false&from=CGK&to=MES&departDate1=30-&departDate2=11-2010&adult=1&child=0&infant=0&returndaterange=0&Submit=Cari"
);

// do access to sriwijaya air
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://booking.sriwijayaair.co.id/b2c/ ... ityServlet");
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_COOKIEJAR, "cookie.txt");

//curl_setopt($curl, CURLOPT_POSTFIELDS, "isReturn=false&from=CGK&to=MES&departDate1=22&departDate2=01-2011&adult=1&child=0&infant=0&returndaterange=0&Submit=Cari");
$curlData = curl_exec($curl);


print_r($curlData);

curl_close($curl);
?>

any help will be appreciate, thanks
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: Need help with ssl curl - flight schedule

Post by Darhazer »

and what is the error
taufikhdyt
Forum Newbie
Posts: 2
Joined: Thu Dec 23, 2010 7:49 am

Re: Need help with ssl curl - flight schedule

Post by taufikhdyt »

HTTP/1.1 500 Internal Server Error
Date: Thu, 23 Dec 2010 12:28:30 GMT
Server: Apache
Set-Cookie: JSESSIONID=E2E17C25491644D4EFFED890D67A464A; Path=/b2c; Secure
Content-Language: en
Vary: Accept-Encoding,User-Agent
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html;charset=ISO-8859-1
Post Reply