api.ipify org code example
Example 1: check ip json
$ curl 'https://api.ipify.org?format=json'
{"ip":"51.159.59.56"}
Example 2: ipify api
<script type="application/javascript">
function getIP(json) {
document.write("My public IP address is: ", json.ip);
}
</script>
<script type="application/javascript" src="https://api.ipify.org?format=jsonp&callback=getIP"></script>
Example 3: apiipify
var http = require('http');
http.get({'host': 'api.ipify.org', 'port': 80, 'path': '/'}, function(resp) {
resp.on('data', function(ip) {
console.log("My public IP address is: " + ip);
});
});