Git Product home page Git Product logo

http-ip-query's Introduction

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

http-ip-query's People

Contributors

thatkalle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.