Get your public IP -- Ascoos Cms function

<?php /* __ _ ___ ___ ___ ___ ___ ____ _ __ ___ ___ / _` |/ / / __/ _ \ / _ \ / / / __/| '_ ` _ \ / / | (_| |\ \| (_| (_) | (_) |\ \ | (__ | | | | | |\ \ \__,_|/__/ \___\___/ \___/ /__/ \___\|_| |_| |_|/__/ */ function getPublicIP($type="A", $host="myip.opendns.com", $server="resolver1.opendns.com") { @exec('nslookup -type=' . $type . ' ' . escapeshellarg($host). ' ' . escapeshellarg($server), $output); return str_replace("Address: ", "",$output[4]); } echo "My Public IP is : " . getPublicIP(); /* Export -> My External IP is : xxx.xxx.xxx.xxx */ ?>
This Ascoos Cms simple function, return the public IP. Can be used and outside of the Ascoos Cms.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.