Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $url_api = "http://partners.api.skyscanner.net/apiservices/pricing/v1.0/";
- $api_key = "XXX"; // Not shown here
- $data = array('apiKey' => $api_key, 'country' => 'DE', 'currency' => 'EUR',
- 'locale' => 'de-DE', 'originplace' => 'HAM', 'destinationplace' => 'AMS', 'cabinclass' => 'economy', 'outbounddate' => '2017-01-27',
- 'inbounddate' => '2017-01-30' , 'locationschema' => 'Iata', 'groupPricing' => true);
- $httpdata = http_build_query($data);
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url_api);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $httpdata);
- curl_setopt($ch, CURLOPT_HEADER, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded', 'Accept: application/json'));
- curl_setopt($ch, CURLOPT_VERBOSE, 1);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
- curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
- $response = curl_exec($ch);
- curl_close($ch);
- $headers = get_headers_from_curl_response($response);
- $url = $headers['Location']."?apiKey=".$api_key."&stops=0";
- echo $url;
- return;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement