PHP
- 3 ответа
- 0 вопросов
1
Вклад в тег
<?php
$url = 'https://mc.api.sberbank.ru:443/prod/tokens/v3/oauth';
$headers = [
'RqUID: f32925a45cc740b1b4c71473f72e5c2c',
'Authorization: Basic **************',
'Content-Type: application/x-www-form-urlencoded'
];
$data = [
'grant_type' => 'client_credentials',
'scope' => 'auth://demo/json'
];
$certPath = 'mycert.12';
$certPass = '********';
$caCertPath = 'russian-trusted-cacert.pem';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSLCERT, $certPath);
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, $certPass);
curl_setopt($ch, CURLOPT_CAINFO, $caCertPath);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>