v2.5.2
Giriş yap

Site Aktif Tutma

frexx
342 defa görüntülendi

Merhaba, yine ben ve yine bir şey yapmaya çalışıyorum. Bir site sunucusu düşünelim ve ben bu sitenin sunucusuna normal girmeden nasıl bir giriş sağlarım. Mesala örnek olarak uptime siteleri. Discord botlarını vb 7/24 aktif edilmesini sağlıyor insan eliyle girilmeden.

wraithdev2
838 gün önce
<?
function ping($host, $port, $timeout) { 
  $tB = microtime(true); 
  $fP = fSockOpen($host, $port, $errno, $errstr, $timeout); 
  if (!$fP) { return "down"; } 
  $tA = microtime(true); 
  return round((($tA - $tB) * 1000), 0)." ms"; 
}

function autoping(){
    // Google.com'un 80 numaralı portunu 10 saniye timeout ile pingler.
    ping("www.google.com", 80, 10);
}
while(true){
    autoping();
    // 5 Saniye bekle
    sleep(5);
}