hotelbeds api如何使用POST請求在pecl_http庫
使用POST請求一些領域所需的API,但是我不知道在哪裏都將被添加的領域! (在GET請求我將字段添加在url等的任何請求)
的API代碼
`
$apiKey = "8z8a7tupn5hubhjxqh8ubuz7";
$sharedSecret = "jsSJq2msbU";
$signature = hash("sha256", $apiKey.$sharedSecret.time());
$endpoint = "https://api.test.hotelbeds.com/activity-api/3.0/activities";
$request = new \http\Client\Request("POST",
$endpoint,
[ "Api-Key" => $apiKey,
"X-Signature" => $signature,
"Accept" => "application/json" ,
]);
$client = new \http\Client;
$client->enqueue($request)->send();
$response = $client->getResponse();
echo "<pre>";
print_r($response->getBody());
echo "</pre>";
的API稱
以下篩選可用於搜索是下面列出。
它包含過濾器的具有以下結構的陣列:
[{ 「searchFilterItems」:[{ 「類型」: 「目的地」, 「值」: 「BCN」}]}]
對象「searchFilterItems」包含以下屬性:type>和value。
以下實施例說明了不同類型和值>每個過濾器:
國家
{ 「類型」: 「國家」, 「值」: 「PT」}