I am creating a flight/hotel reservation system like farecompare.com Farecompare parse values to other sites and create sessions other sites too. Anyone tell me how they create sesssions in it. I can parse url but i am not able to create sessions.

public function flight($depart, $return, $from, $to, $type, $class,
                       $adults, $seniors, $children) {

    $dep = explode("/", $depart);
    $ret = explode("/", $return);

    if ($type == 'RoundTrip') {
        $expurl = 'http://www.expedia.co.in/Flights-Search?trip=' .
                  strtolower($type) . '&leg1=from%3A' . $from .
                  '%29%2Cto%3A' . $to .
                  '%29%2Cdeparture%3A' . $dep[1] .
                  '/'.$dep[0].'/'.$dep[2].
                  'TANYT&leg2=from%3A' . $to .
                  '%29%2Cto%3A' . $from .
                  '%29%2Cdeparture%3A' .
                  $ret[1].'/'.$ret[0].'/'.$ret[2] .
                  'TANYT&passengers=children%3A' . $children .
                  '%2Cadults%3A' . $adults .
                  '%2Cseniors%3A' . $seniors .
                  '%2Cinfantinlap%3AY&options=cabinclass%3Aeconomy'. 
                  '%2Cnopenalty%3AN%2Csortby%3Aprice&mode=search';

        echo '<a href = "' . $expurl . '" target = "_blank">Expedia</a>';
    } else {
        $type = 'oneway';

        $expurl = 'http://www.expedia.co.in/Flights-Search?trip='.
                  strtolower($type) . '&leg1=from%3A' . $from .
                  '%29%2Cto%3A' . $to . '%29%2Cdeparture%3A' .
                  $dep[1].'/'.$dep[0].'/'.$dep[2] .
                  'TANYT&passengers=children%3A' . $children .
                  '%2Cadults%3A' . $adults .
                  '%2Cseniors%3A' . $seniors .
                  '%2Cinfantinlap%3AY&options=cabinclass%3Aeconomy'. 
                  '%2Cnopenalty%3AN%2Csortby%3Aprice&mode=search';
        echo '<a href = "' . $expurl . '" target = "_blank">Expedia</a>';
    }
}

I worked on Expedia by parsing url to get data but there are other sites like cheapoait, travelocity etc which uses sessions. How to create sessions?

You can create sessions on your server only, not on other servers. To create a session put the session_start() command on the beginning of your script. Then assign values to the $_SESSION array. On each script that contains a session_start command you can read and change these values. The values can be of most php types (integer, float, string, array...).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.