$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://api.direct.yandex.ru/live/v4/json/');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,'{
"method": "AccountManagement",
"token": "AQAAAAAW-*******************************",
"param": {"SelectionCriteria": {}, "Action": "Get"}}'); //Post Fields
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = [
'POST /json/v5/ads/ HTTP/1.1',
'Host: api.direct.yandex.com',
'Authorization: Bearer AQAAAAAW-**********************************',
'Accept-Language: ru',
'Client-Login: *************@yandex.ru',
'Content-Type: application/json; charset=utf-8',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$server_output = curl_exec ($ch);
curl_close ($ch);
$balance_direct_miramall = json_decode($server_output,true);
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);
}