Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. <?php
  2.  
  3.     $SNIP1 = "1234";
  4.     $SNIP2 = "1234";
  5.     $curip = dns_get_record("cag.nightwire.de")[0]["ip"];
  6.     $ipalive = "";
  7.    
  8.     function Connect($ip) {
  9.         $serverConn = @stream_socket_client("tcp://{$ip}:443", $errno, $errstr);
  10.         if ($errstr != '') {
  11.             return false;
  12.         }
  13.         fclose($serverConn);
  14.         return true;
  15.     }
  16.  
  17.     if(Connect($SNIP1)){
  18.         echo("SNIP1");
  19.         $ipalive = $SNIP1;
  20.     }elseif(Connect($SNIP2)){
  21.         echo("SNIP2");
  22.         $ipalive = $SNIP2;
  23.     }
  24.    
  25.     if($ipalive != $curip){
  26.         $url = "https://ddns.do.de/?username=XXXXX&password=XXXXXXX&hostname=XXXXXXXXXXXX&myip=" . $ipalive;
  27.         print("Alte IP: {$curip}<br/>Neue IP: {$ipalive}");
  28.         $curl = curl_init();
  29.         curl_setopt($curl, CURLOPT_URL, $url);
  30.         curl_exec($curl);
  31.     }else{
  32.         print("Update nicht notwendig");
  33.     }
  34.    
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement