Created
March 24, 2021 08:29
-
-
Save ibnux/e0f4a6411bcc5dfae1aef13ae9898b8c to your computer and use it in GitHub Desktop.
Script untuk check session go whatsapp rest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Simpan di folder project go whatsapp rest | |
* disebelah Dockerfile | |
* jalankan cronjob setiap 5 menit | |
* cronjob: */5 * * * * cd /path/to/go-whatsapp-rest && php check.php | |
*/ | |
$file = "./config/085156812578.gob"; | |
$path = "./config/stores/085156812578.gob"; | |
$bot_telegram = ''; | |
$chat_id = '1234567'; | |
if(!file_exists($path)){ | |
copy($file,$path); | |
echo "sudah dicopy \n"; | |
if(!empty($bot_telegram)){ | |
file_get_contents('https://api.telegram.org/bot'.$bot_telegram.'/sendMessage?chat_id='.$chat_id.'&text='.urlencode("Wa dicopy lagi")); | |
} | |
}else{ | |
$md5a = md5_file($file); | |
$md5b = md5_file($path); | |
if($md5a!=$md5b){ | |
unlink($file); | |
copy($path,$file); | |
echo "update file\n"; | |
if(!empty($bot_telegram)){ | |
file_get_contents('https://api.telegram.org/bot'.$bot_telegram.'/sendMessage?chat_id='.$chat_id.'&text='.urlencode("Session Wa baru dicopy lagi")); | |
} | |
}else echo "masih ada \n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to use