Пользователь пока ничего не рассказал о себе

Наибольший вклад в теги

Все теги (10)

Лучшие ответы пользователя

Все ответы (5)
  • Как оформить данный CURL запрос на PHP?

    @fokit
    <?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;
    
    ?>
    Ответ написан
    1 комментарий

Лучшие вопросы пользователя

Все вопросы (6)