$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);
type struct_json struct {
Function string
Data json.RawMessage
}
type get_Dir_Db_struct_json struct {
Param1 string
Param2 string
}
var var_struct_json = &struct_json{}
var b = []byte(`{"function": "get_Dir_Db", "data": {"param1":"111","param2":"222"} }`)
err := json.Unmarshal(b, var_struct_json)
if err != nil {
log.Println("error:", err)
}
switch var_struct_json.Function {
case "get_Dir_Db":
var var_get_Dir_Db_struct_json = &get_Dir_Db_struct_json{}
err := json.Unmarshal(var_struct_json.Data, var_get_Dir_Db_struct_json)
if err != nil {
log.Println("error:", err)
}
log.Println("-",var_get_Dir_Db_struct_json.Param1)
case "other":
// ...
default:
log.Println("Функция,которую отослал клиент, не распознана- ", var_struct_json.Function)
}
chown :group1 /home/Shared_files
svn export https://github.com/user/repo/path/to/folder