Answer the question
In order to leave comments, you need to log in
How to perform authorization with CURL?
There is a webinar service, Bizon.
It is necessary to pull out certain data using API methods.
The documentation says:
In each request, it is necessary to pass the X-Token header with the value of the token received in the system interface, in the "Moderators, employees" section for a specific user
function getViewers() {
$url = 'https://online.bizon365.ru/api/v1/webinars/reports/get?webinarId=k21vrp8018';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['X-Token' => 'r--zAKaFHBbxZfRtptHSWZbM0KaKBSWfWfAtpFrBbXZfRYaYS']);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_HEADER,1);
$res = curl_exec($ch);
if(curl_exec($ch) === false)
{
echo 'Ошибка curl: ' . curl_error($ch);
}
else
{
echo 'Операция завершена без каких-либо ошибок';
}
curl_close($ch);
return $res;
}
Операция завершена без каких-либо ошибокstring(750) "HTTP/1.1 401 Unauthorized
Server: nginx
Date: Wed, 23 Oct 2019 09:06:01 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 61
Connection: keep-alive
X-DNS-Prefetch-Control: off
X-Frame-Options: SAMEORIGIN
Strict-Transport-Security: max-age=15552000; includeSubDomains
X-Download-Options: noopen
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, X-Token
Access-Control-Allow-Method: HEAD OPTIONS GET POST PUT UPDATE PATCH
Access-Control-Max-Age: 86400
Access-Control-Allow-Credentials: true
ETag: W/"3d-Mr4ZKSjs1pqgYB0Nxs6WGvsAoLM"
{"status":401,"message":"Вы не авторизованы"}"
X-Token
, which I gave away.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question