Skip to content

ThatKalle/http-ip-query

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

http-ip-query

A simple HTML/JS/PHP webapp displaying client internal- and external IP information.

It works with a local PHP api getIP.php and WebRTC.

Features:
Copy to Clipboard
Local IP via WebRTC
External IP via local PHP api
Language localization
HTTPS redirect
Curl support

preview

Prerequisites

You'll need a web server with PHP enabled. Pretty much any version should work.

<? $_SERVER['REMOTE_ADDR']; ?>

Installing

Deploy the files to a PHP enabled web server.

~$ git clone https://github.com/ThatKalle/http-ip-query.git
~$ cp -r ./http-ip-query/* /var/www/public_html

Localization

Localization is supported and tested to Swedish with English as a default fallback.
Adjustemnts are all handeled in script.js.

    // Localization
    if(navigator.language == 'sv' || navigator.language == 'sv-SE') {
        // Swedish
        localIpv4Info.innerHTML = "Din lokala IP address är";
        publicIpInfo.innerHTML = "Din publika IP address är";
        localIp.innerHTML = "Endast tillgängligt i Chrome eller Firefox, sorry!";
        Array.prototype.forEach.call(btn, function(el, i){
            el.value = "Kopiera till urklipp";
        });
    } else { ...

To find the navigator.language value for your language you'll not need to look further than the browser developer tools console.
Open up any site, hit F12, type navigator.language in the console.

Usage

This solution is tested and working in common browsers at their respective latest versions. Work done to include IE and Edge.
Local IP won't work in IE and Edge as they don't support WebRTC, helpful message displayed.

cli.php is set up to easily find you're external IP via CLI.

~$ curl -L http://ip.kallelab.com/api/cli && echo
198.51.100.132
# [System.Net.ServicePointManager]::SecurityProtocol = @("Tls12","Tls11","Tls","Ssl3")
(New-Object System.Net.WebClient).DownloadString("https://ip.kallelab.com/api/cli")
198.51.100.132

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

About

A simple HTML/JS/PHP webapp displaying client internal- and external IP information.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published