请把一段php 转为JSP代码

来源:百度知道 编辑:UC知道 时间:2024/05/23 17:29:06
<?PHP
$arr = explode(" ", microtime());
$rst = $arr[1] . substr($arr[0], strpos($arr[0], '.') + 1, 3);

$url = "http://www.blueforge.net/map/?rs=get_ip_info&rst=&rsrnd=" . $rst . "&rsargs[]=" . $ip;
$rs = @file_get_contents($url);
preg_match("/{(.*)}/", $rs, $matches);

$str = '$arr=array(' . str_replace(':', '=>', $matches[1]) . ');';
$str = str_replace('parseFloat', 'floatVal', $str);
eval($str);
print_r($arr);

?>

<%
String[] arr=microtime().split(" ");
String rst=arr[0]+arr[1].substring(arr[0].indexOf(".")+1,3);
String url= "http://www.blueforge.net/map/?rs=get_ip_info&rst=&rsrnd=" +rst + "&rsargs[]=" +ip;//ip
String rs="";
URL urlLink=new URL(url);
HttpURLConnection connection=(HttpURLConnection)urlLink.openConnection();
connection.connect();
Scanner s=new Scanner(connection.getInputStream());
while(s.hasNextLine()){
String line=s.nextLine();
rs=rs+line;
}
s.close();
connection.disconnect();
Pattern p = Pattern.compile("/{(.*)}/");
Matcher m = p.matcher(rs);
List<String> list=new ArrayList<String>();
while(m.find()){
list.add(m.grou