Personal Mini Web Server with UPS option Circadea   contact home

Raspberry Pi

Litium Battery Pack as UPS

Dns fix
DNS server
Content Upload Page
Php page displays current IP address
NGINX
server port page
server wan page
$wanIP=file_get_contents("http://www.whatismyip.com/automation/n09230945.asp");

function getWANIP() { $url = "http://automation.whatismyip.com/n09230945.asp"; $ch = curl_init(); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0"); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt( $ch, CURLOPT_ENCODING, "UTF-8"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //UNCOMMENT TO DEBUG TO output.tmp //curl_setopt($ch, CURLOPT_VERBOSE, true); // Display communication with server //$fp = fopen("output.tmp", "w"); //curl_setopt($ch, CURLOPT_STDERR, $fp); // Display communication with server $response = curl_exec($ch); curl_close($ch); if ( $response === FALSE ) { throw new Exception("Error while retrieving server data: " . curl_error($ch)); } return $response; }\
<?PHP function getUserIP() { $client = @$_SERVER['HTTP_CLIENT_IP']; $forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; $remote = $_SERVER['REMOTE_ADDR']; if(filter_var($client, FILTER_VALIDATE_IP)) { $ip = $client; } elseif(filter_var($forward, FILTER_VALIDATE_IP)) { $ip = $forward; } else { $ip = $remote; } return $ip; } $user_ip = getUserIP(); echo $user_ip; // Output IP address [Ex: 177.87.193.134] ?>