Skip to content

Instantly share code, notes, and snippets.

@ibnux
Created March 24, 2021 08:29
Show Gist options
  • Select an option

  • Save ibnux/e0f4a6411bcc5dfae1aef13ae9898b8c to your computer and use it in GitHub Desktop.

Select an option

Save ibnux/e0f4a6411bcc5dfae1aef13ae9898b8c to your computer and use it in GitHub Desktop.
Script untuk check session go whatsapp rest
<?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";
}
@abcdgol
Copy link
Copy Markdown

abcdgol commented May 29, 2022

how to use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment