Monday, 21 April 2014

How to get IP address using a specific weblog

Example input :

  96.7.4.14 - - [24/Apr/2011:04:20:11 -0400] "GET /cat.jpg HTTP/1.1" 200 12433

String[] fields = value.toString().split(" ");
if (fields.length > 0) {
 String ip = fields[0];
}

 String variable "ip" gives IP Address

No comments:

Post a Comment