M
M
Maxim Plotnikov2019-09-17 10:26:53
PHP
Maxim Plotnikov, 2019-09-17 10:26:53

How to make the simplest request in qiwi api?

Good day, I started to study qiwi api and stalled at the first moment.
I wrote a code to get account information.

$json = '
      Authorization: Bearer *******
    ';

$url = 'https://edge.qiwi.com/person-profile/v1/profile/current?authInfoEnabled=false';


$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response  = curl_exec($ch);
curl_close($ch);
echo $response;

But it gives this error, what should I do?
{"serviceName":"qw-person-profile","errorCode":"http.method.not.supported","description":"Method is not supported","userMessage":"Method is not supported"," dateTime":"2019-09-17T10:10:11.806+03:00","traceId":"45c51ecd6d41eb60"}

How to make a cURL request in php.
Thanks in advance ;)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Neverov, 2019-09-17
@kakisaebalsujit

Use Guzzle for requests , it's much easier than cURL.
And you somehow strangely carry out authorization.
Authorization: Bearer *******- it should be the request headers, not the body.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question