public ip api 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>