Microsoft
- 1 ответ
- 0 вопросов
2
Вклад в тег
function direct__GetReports($token, $login) {
$params = array(
'method' => "AccountManagement",
'param' => array(
'Action' => "Get",
'SelectionCriteria' => array(
'Logins' => array($login),
),
),
'locale' => "ru",
'token' => $token,
);
$headers = array(
'POST /json/v5/ads/ HTTP/1.1',
'Host: api.direct.yandex.com',
'Authorization: Bearer ' . $token,
'Accept-Language: ru',
'Client-Login: ' . $login,
'Content-Type: application/json; charset=utf-8',
);
$url = 'https://api.direct.yandex.ru/live/v4/json/';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$server_output = curl_exec($ch);
curl_close($ch);
return json_decode($server_output, true);
}