<?php
$checkin_date = "2017-05-05";
$checkout_date = "2017-05-08";
$guests = 10;
$rooms= 4;
$country_iso_code = "UK";
$country_currency = "EUR";
$locale_lang = "en-GB";
$url = "http://partners.api.skyscanner.net/apiservices/hotels/liveprices/v2/$country_iso_code/$country_currency/$locale_lang/27539733/$checkin_date/$checkout_date/$guests/$rooms?apiKey=prtl6749387986743898559646983194";
$ch = curl_init();
$http_header = ["Content_type : application/json"];
$options = [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTPHEADER => $http_header
];
curl_setopt_array($ch, $options);
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
//Json 中的响应
这只是基本代码,您如何使用 curl 访问 skyscanner 的 api 以获取 json 格式的数据