Я пытаюсь интегрироваться с API Sabre, используя PHP и свои тестовые учетные данные. Однако я получаю ответ: «Массив ([ошибка] => инвалид_клиент [ошибка_описание] => Неверный clientID или clientSecret)».
Документация Sabre:
https://developer .sabre.com/docs/rest_apis/session_management/token_create_api/v2
https://developer.sabre.com/guides/trav ... apis-token -credentials
Любые предложения или помощь по моему коду приветствуются.
$saberUrl = 'https://api.platform.sabre.com/v2/auth/token';
$credentials = [
'user_id' => 'V1:uname:DEVCENTER:AA',
'password' => 'pwd'
];
$base64EncodeConcat =base64_encode(base64_encode($credentials['user_id']) . ':' . base64_encode($credentials['password']));
// Initialize cURL session
$curl = curl_init($saberUrl);
// Set cURL options
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/x-www-form-urlencoded',
'Authorization: Basic ' . $base64EncodeConcat
));
// Include the grant_type parameter in the POST fields
curl_setopt($curl, CURLOPT_POSTFIELDS, "grant_type=client_credentials");
// Execute cURL session
$response = curl_exec($curl);
// Close cURL session
curl_close($curl);
// Process the response
$data = json_decode($response, true);
// Output the data
print_r($data);
Подробнее здесь: https://stackoverflow.com/questions/790 ... ntegration
Интеграция Sabre Dev API ⇐ Php
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение