Answer the question
In order to leave comments, you need to log in
How to specify dates when requesting VK group statistics?
Hello, I want to get statistics data, for example, from 04/21/2019 to 04/28/2019
I make the request as follows (I use the official library):
function show($data){
print_r ("{$data}.<br>");
}
$date = "2019-04-21";
$now = date ("Y-m-d",time ());
echo strtotime ($date)."---".time ()."<br>";
$nd = $vk->stats ()->get($token,[
"group_id"=>"000000000",
"interval"=>"week",
"timestamp_from" => strtotime ($date),
"timestamp_to" => strtotime ($now),
"stats_groups" => "visitors"
]);
print_r ("С ".date ("Y-m-d",$nd[0]["period_from"])."<br>");
print_r ("По ".date ("Y-m-d",$nd[0]["period_to"])."<br>");
show ("Всего просмотров за период: {$nd[0]["visitors"]['views']}");
show ("Всего посетителей за период: {$nd[0]["visitors"]['visitors']}");
print_r ($nd[0]);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question