请把一段php 转为JSP代码
<?PHP$arr=explode("",microtime());$rst=$arr[1].substr($arr[0],strpos($arr[0],'.')+1,3...
<?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);
?> 展开
$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);
?> 展开
2009-11-20
展开全部
<%
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.group());
}
String str="arr=array"+list.get(1).replaceAll(":","=>")+");";
str=str.replaceAll("parseFloat", "floatVal");
eval($str); //这句有点复杂
out.println(arr); //jsp上输出
%>
需要
java.util.*;
java.util.regex.*;
java.net.*;
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.group());
}
String str="arr=array"+list.get(1).replaceAll(":","=>")+");";
str=str.replaceAll("parseFloat", "floatVal");
eval($str); //这句有点复杂
out.println(arr); //jsp上输出
%>
需要
java.util.*;
java.util.regex.*;
java.net.*;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询