· 6 years ago · Nov 17, 2018, 08:50 PM
1$oauth = $Settings['API']['oauth_token'];
2 $login = $Settings['API']['user_login'];
3
4 #Соединение Ñ API Метрика
5
6 $method = 'counters'; // По умолчанию(Ñвоему умолчанию).
7 $request_params = array(
8 "user_login" => $login,
9 "oauth_token" => $oauth
10 );
11 $query = http_build_query($request_params);
12 $result = file_get_contents('https://api-metrika.yandex.ru/management/v1/'.$method.'?'.$query);
13 $result = json_decode($result);
14 echo'<pre>',print_r($result,true),'</pre>';
15 foreach($result as $key => $value){
16 foreach ($value[0] as $item => $v){
17 echo'<pre>'.$v['name'].'</pre>';
18 }
19 }
20
21stdClass Object
22 (
23 [rows] => 1
24 [counters] => Array
25 (
26 [0] => stdClass Object
27 (
28 [id] => 35080600
29 [status] => Active
30 [owner_login] => elcador2013
31 [code_status] => CS_OK
32 [name] => ФлориуÑ
33 [type] => simple
34 [favorite] => 0
35 [hide_address] => 0
36 [permission] => edit
37 [webvisor] => stdClass Object
38 (
39 [urls] => regexp:.*
40 [arch_enabled] => 0
41 [arch_type] => none
42 [load_player_type] => proxy
43 [wv_version] => 2
44 [allow_wv2] => 1
45 [wv_forms] => 1
46 )
47
48 [code_options] => stdClass Object
49 (
50 [async] => 1
51 [informer] => stdClass Object
52 (
53 [enabled] => 0
54 [type] => ext
55 [size] => 1
56 [indicator] => pageviews
57 [color_start] => FFFFFFFF
58 [color_end] => EFEFEFFF
59 [color_text] => 0
60 [color_arrow] => 1
61 )
62
63 [visor] => 1
64 [ut] => 0
65 [track_hash] => 1
66 [xml_site] => 0
67 [clickmap] => 1
68 [in_one_line] => 0
69 [ecommerce] => 1
70 [alternative_cdn] => 0
71 [ecommerce_object] => dataLayer
72 )
73
74 [create_time] => 2016-02-02T15:26:14+03:00
75 [time_zone_name] => Europe/Moscow
76 [time_zone_offset] => 180
77 [partner_id] => 0
78 [site] => florius.ru
79 [site2] => stdClass Object
80 (
81 [site] => florius.ru
82 [domain] => florius.ru
83 )
84
85 [gdpr_agreement_accepted] => 0
86 )
87
88 )
89
90 )