使用 CURL 的所有酒店位置的 Skyscanner API
Skyscanner API for all hotel locations using CURL
我正在尝试从 skyscanner api 获取地理目录数据。我已阅读文档
http://business.skyscanner.net/portal/en-GB/Documentation/ApiOverview
我已经创建了 api 密钥。我成功地击中了 api 并获得了与
http://business.skyscanner.net/portal/en-GB/Documentation/HotelsLivePricingQuickStart
我正在打:-
http://partners.api.skyscanner.net/apiservices/hotels/autosuggest/v2/UK/GBP/en-GB/.$cityname.?apikey=prtl6749387986743898559646983194
我想在 JSON 中得到回应。可能吗??
我已经成功获取航班实时价格link [Get error in using skyscanner Api of flight pricing in php 使用 POST 方法。
<?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
这只是基本代码,您如何点击 skyscanner 的 api 以使用 curl
获取 json 格式的数据
我正在尝试从 skyscanner api 获取地理目录数据。我已阅读文档 http://business.skyscanner.net/portal/en-GB/Documentation/ApiOverview
我已经创建了 api 密钥。我成功地击中了 api 并获得了与 http://business.skyscanner.net/portal/en-GB/Documentation/HotelsLivePricingQuickStart
我正在打:-
http://partners.api.skyscanner.net/apiservices/hotels/autosuggest/v2/UK/GBP/en-GB/.$cityname.?apikey=prtl6749387986743898559646983194
我想在 JSON 中得到回应。可能吗??
我已经成功获取航班实时价格link [Get error in using skyscanner Api of flight pricing in php 使用 POST 方法。
<?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
这只是基本代码,您如何点击 skyscanner 的 api 以使用 curl
获取 json 格式的数据