jsonip.appspot.com Over Quota

It appears that jsonip.appspot.com is over quota. What alternatives do you have?

  • http://jsonip.com/
  • http://freegeoip.appspot.com/ – This one is currently over quota as well

Have another? Post it below!

Or, Write Your Own with PHP:

<?php

$ip = !empty($_SERVER['REMOTE_ADDR'])?$_SERVER['REMOTE_ADDR']:'';
$json = array();
$json['ip'] = $ip;

if(!empty($_GET['callback'])){
    //remove non standard characters if callback is set
    $callback = preg_replace('#[^a-zA-Z0-9\-\_]#','',$_GET['callback']);
}

if(!empty($callback)){
    //if callback still exists after cleaning up non standard characters
    //then call that function with the IP data
    echo $callback.'('.json_encode($json).');'; 
}else{
    //else echo the IP data
    echo json_encode($json);
}

?>

Note: It is important to put this on a FAST server otherwise your webpage might hang when loading, especially if you are using the a doc-ready syntax for javascript.

Have improvements? Post them below.

Related Posts:

  • No Related Posts
This entry was posted in Web Development. Bookmark the permalink.

2 Responses to jsonip.appspot.com Over Quota

Leave a Reply

Your email address will not be published. Required fields are marked *