<?
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://api.direct.yandex.com/json/v5/campaigns');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,'{"method":"get","params":{"SelectionCriteria":{},"FieldNames":["Name"]}}'); //Post Fields
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = [
'POST /json/v5/ads/ HTTP/1.1',
'Host: api.direct.yandex.com',
'Authorization: Bearer TOKEN',
'Accept-Language: ru',
'Client-Login: clientname',
'Content-Type: application/json; charset=utf-8',
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$server_output = curl_exec ($ch);
curl_close ($ch);
print $server_output;
Запрос в Яндекс Директ по api php v5
yandex direct api v5 php oauth token curl campaigns. Пример запроса для получения всех кампаний клиента в директе яндекса. Версия v5. Указвыаем токен, сервис, логин клиента, параметры. Токен получаем через https://oauth.yandex.ru/authorize?response_type=token&client_id=идентификатор_приложения