This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Add to head style tag */ | |
[data-loadscreen] { | |
opacity: 1; | |
z-index: 10000; | |
width: 100vw; | |
height: 100vh; | |
position: fixed; | |
top: 0; | |
left: 0; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const https = require('https'); | |
const options = { | |
hostname: 'httpbin.org', | |
port: 443, | |
path: '/ip', | |
method: 'GET' | |
} | |
const req = https.request(options, res => { | |
res.on('data', d => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getPublicIP() { | |
var xhr = new XMLHttpRequest(); | |
xhr.open("GET", "http://httpbin.org/ip", true); // false for synchronous request | |
xhr.onload = function(e) { | |
if (xhr.readyState === 4) { | |
if (xhr.status === 200) { | |
let yourWanIP = JSON.parse(xhr.responseText).origin; | |
// do what you want to do with the IP address | |
// ... eg. log it to the console | |
console.log(yourWanIP); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getPublicIP() { | |
fetch('http://httpbin.org/ip') | |
.then(response => response.json()) | |
.then(data => { | |
// do what you want to do with the IP address | |
// ... eg. log it to the console | |
console.log(data.origin); | |
}); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getPublicIP() { | |
// create & initialize a curl session | |
$curl = curl_init(); | |
// set our url with curl_setopt() | |
curl_setopt($curl, CURLOPT_URL, "http://httpbin.org/ip"); | |
// return the transfer as a string, also with setopt() |