Answer the question
In order to leave comments, you need to log in
Executing a php script every few seconds how?
there is such a code
$statusg = json_decode(file_get_contents('https://api.vk.com/method/status.get'. '?' .urldecode(http_build_query($statusget))), true);
$status_data = ($statusg['response']['text']);
<div class="data_status">Сечас играет: <?php echo "$status_data"; ?></div>
Answer the question
In order to leave comments, you need to log in
There are 2 obvious options:
1) Pull through the setInterval JavaScript function in which PHP will be called from the server, which will learn the data about the song from the VK API and display it, and the javascript that receives this data will display it on the page.
2) Direct access to VK API via JAvascript
Cron once per minute, inside this script sleep(10) will be 6 times per minute
bash:
while true; do
php -f script.php
sleep 10
done
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question