By Alvin Alexander. Last updated: June 6, 2016
This is a quick example of how to use the geolocation web service at http://www.hostip.info/use.html using Scala:
/** * an example of how to use the geolocation web service at * http://www.hostip.info/use.html * using scala */ object GetRestContent extends App { val url = "http://api.hostip.info/get_json.php?ip=12.215.42.19" val result = scala.io.Source.fromURL(url).mkString println(result) }
I don't show how to handle the JSON string in this example, but if you search this website you'll find other Scala JSON examples.