-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustom_field_cont.php
More file actions
115 lines (103 loc) · 3.06 KB
/
custom_field_cont.php
File metadata and controls
115 lines (103 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
include "cUrls.php";
function add_field_mult()
{
global $Response;
$val = $_GET['val'];
$name = $_GET['mul'];
$fields = [
'add' => [
0 => [
'name' => $name,
'type' => '5',
'element_type' => '1',
'origin' => 'qwer',
'enums' => [
0 => $val[0],
1 => $val[1],
2 => $val[2],
3 => $val[3],
4 => $val[4],
5 => $val[5],
6 => $val[6],
7 => $val[7],
8 => $val[8],
9 => $val[9],
],
],
],
];
Send_amo('fields',$fields);
global $id_field;
$id_field = $Response["_embedded"]['items'][0]['id'];
$Response = $Response['_embedded']['items'];
$output = 'ID добавленных полей:' . PHP_EOL;
var_dump($id_field);
foreach ($Response as $v)
if (is_array($v))
$output .= $v['id'] . PHP_EOL;
return $output;
}
function all_value_fild()
{
global $Response;
global $id_field;
Send_amo('account?with=custom_fields');
global $arr;
$a = $Response['_embedded']['custom_fields']['contacts'][$id_field]['enums'];
$arr = array_keys($a);
var_dump($a);
// $Response = $Response[0];
}
function accaunt()
{
global $Response;
Send_amo('contacts');
$Response = $Response['_embedded']['items'];
global $first_names;
$first_names = array_column($Response, 'id');
}
function randome()
{
if (isset($_GET['subb']) and isset($_GET['val'])) {
global $arr;
global $first_names;
global $id_field;
for ($i = 0; $i < count($first_names); $i++) {
$str = ['', '', '', '', '', '', '', '', '', ''];
$array = array_merge($arr, $str);
shuffle($array);
$data = [
'update' => [
0 => [
'id' => $first_names[$i],
'updated_at' => time(),
'custom_fields' => [
0 => [
'id' => $id_field,
'values' => [
0 => $array[0],
1 => $array[1],
2 => $array[2],
3 => $array[3],
4 => $array[4],
5 => $array[5],
6 => $array[6],
7 => $array[7],
8 => $array[8],
9 => $array[9],
],
],
],
],
],
];
Send_amo( "contacts",$data);
}
}
}
add_field_mult();
all_value_fild();
accaunt();
randome();
header('Location:add_field.php');