@@ -54,12 +54,12 @@ public function apiWidget($widget, $method, $period, $date, $limit, $lang) {
5454 $ url = $ this ->url ;
5555 $ url .= "?module=API&method= " . $ method ;
5656 $ url .= "&idSite= " . $ this ->id ."&period= " . $ period ."&date= " . $ date ;
57- $ url .= "&format=PHP &language= " . $ lang ;
57+ $ url .= "&format=JSON &language= " . $ lang ;
5858 $ url .= $ limit ? "&filter_limit= " . $ limit : '' ;
5959 $ url .= "&token_auth= " . $ this ->token ;
6060
6161 $ fetched = file_get_contents ($ url );
62- $ content = unserialize ($ fetched );
62+ $ content = json_decode ($ fetched, true );
6363
6464 return $ content ;
6565 }
@@ -70,7 +70,7 @@ public function apiBulkWidgets($widgets, $period, $date, $limit, $lang) {
7070 $ url = $ this ->url ;
7171
7272 $ url .= "?module=API&method=API.getBulkRequest " ;
73- $ url .= "&token_auth= " . $ this ->token ."&format=PHP " ;
73+ $ url .= "&token_auth= " . $ this ->token ."&format=JSON " ;
7474
7575 $ i = 0 ;
7676 foreach ($ widgets as $ widget ) {
@@ -80,7 +80,7 @@ public function apiBulkWidgets($widgets, $period, $date, $limit, $lang) {
8080 }
8181
8282 $ fetched = file_get_contents ($ url );
83- $ content = unserialize ($ fetched );
83+ $ content = json_decode ($ fetched, true );
8484
8585 return $ content ;
8686 }
@@ -89,10 +89,10 @@ public function apiChart($method, $period, $date) {
8989 $ url = $ this ->url ;
9090 $ url .= "?module=API&method= " . $ method ;
9191 $ url .= "&idSite= " . $ this ->id ."&period= " . $ period ."&date= " . $ date ;
92- $ url .= "&format=PHP &token_auth= " . $ this ->token ;
92+ $ url .= "&format=JSON &token_auth= " . $ this ->token ;
9393
9494 $ fetched = file_get_contents ($ url );
95- $ content = unserialize ($ fetched );
95+ $ content = json_decode ($ fetched, true );
9696
9797 return $ content ;
9898 }
@@ -101,10 +101,10 @@ public function apiOverview($method, $period, $date) {
101101 $ url = $ this ->url ;
102102 $ url .= "?module=API&method= " . $ method ;
103103 $ url .= "&idSite= " . $ this ->id ."&period= " . $ period ."&date= " . $ date ;
104- $ url .= "&format=PHP &token_auth= " . $ this ->token ;
104+ $ url .= "&format=JSON &token_auth= " . $ this ->token ;
105105
106106 $ fetched = file_get_contents ($ url );
107- $ content = unserialize ($ fetched );
107+ $ content = json_decode ($ fetched, true );
108108
109109 return $ content ;
110110 }
@@ -115,10 +115,10 @@ public function apiRealtime() {
115115
116116 $ url .= "?module=API&method= " . $ method ;
117117 $ url .= "&idSite= " . $ this ->id ."&lastMinutes=3 " ;
118- $ url .= "&format=PHP &token_auth= " . $ this ->token ;
118+ $ url .= "&format=JSON &token_auth= " . $ this ->token ;
119119
120120 $ fetched = file_get_contents ($ url );
121- $ content = unserialize ($ fetched );
121+ $ content = json_decode ($ fetched, true );
122122
123123 return $ content ;
124124 }
@@ -127,7 +127,7 @@ public function apiBulkSummary() {
127127 $ url = $ this ->url ;
128128
129129 $ url .= "?module=API&method=API.getBulkRequest " ;
130- $ url .= "&token_auth= " . $ this ->token ."&format=PHP " ;
130+ $ url .= "&token_auth= " . $ this ->token ."&format=JSON " ;
131131
132132 $ url .= "&urls[0]= " ;
133133 $ url .= urlencode ("method=VisitsSummary.getVisits&idSite= " . $ this ->id ."&period=day&date=today " );
@@ -142,7 +142,7 @@ public function apiBulkSummary() {
142142 $ url .= urlencode ("method=VisitsSummary.getVisits&idSite= " . $ this ->id ."&period=year&date=today " );
143143
144144 $ fetched = file_get_contents ($ url );
145- $ content = unserialize ($ fetched );
145+ $ content = json_decode ($ fetched, true );
146146
147147 return $ content ;
148148 }
@@ -151,11 +151,11 @@ public function apiPageMetrics($period, $uri, $lang) {
151151 $ url = $ this ->url ;
152152 $ url .= "?module=API&method=Actions.getPageUrls " ;
153153 $ url .= "&idSite= " . $ this ->id ."&period= " . $ period ."&date=today " ;
154- $ url .= "&format=PHP &token_auth= " . $ this ->token ;
154+ $ url .= "&format=JSON &token_auth= " . $ this ->token ;
155155 $ url .= $ lang ['multilang ' ] ? '&expanded=1 ' : '' ;
156156
157157 $ fetched = file_get_contents ($ url );
158- $ content = unserialize ($ fetched );
158+ $ content = json_decode ($ fetched, true );
159159 $ content = $ this ->filterPageMetrics ($ content , $ uri , $ lang );
160160 return $ content ;
161161 }
0 commit comments