Answer the question
In order to leave comments, you need to log in
How to make autostuts vk with a countdown timer?
Help me please! I really need a script or service to display the countdown timer in the VK status. That is, the status will contain the number of days left until a certain event.
Answer the question
In order to leave comments, you need to log in
HELP the soldier) I want to go home, I know myself)!
On my knees, therefore, I wrote like this, but it works with a bang.
This is all in Cron on any hosting (free) or for 100 rubles a year (.xyz) and that's it.
Task to start Cron at 00:01 for example) and that's it.
<html><body>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<?php
//Твой токен
define('token_user', '76305ff9beaa4ae1a4fea541');
// Часовой пояс
date_default_timezone_set('Europe/Volgograd');
// Дата дембеля
$_dembel = '2017-11-25';
$today = date('Y-m-j');
$datetime1 = date_create($today);
$datetime2 = date_create($_dembel);
$interval = date_diff($datetime2, $datetime1);
$_status = $interval->format('%R%a дней до дома =)');
function metog_get ($_metod= null, $_paramm = null) {
$url = trim($_metod.http_build_query($_paramm));
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
$data = curl_exec($curl);
curl_close($curl);
if ($data != null) {
return $data;
} else {
return 'Error = ' .$data;
}
}
$_param = array('text' =>$_status ,
'access_token' =>token_user
);
$_response = metog_get('https://api.vk.com/method/status.set?',$_param);
//"response": 1
$_id_status = json_decode($_response)-> response;
if (is_int($_id_status) == 1 ) {
echo 'OK = ' .$_status ;
} else{
echo ('Er = '.$_id_status);
}
?>
</body>
</html>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question