从另一个站点获取其返回值

从另一个站点获取其返回值
URL url = new URL("http://125.60.29.90/sp/jsp/culvoucher/CULRetrieveGrteFg.jsp?ssn='"+nmb.getUSER_REG_NUMBER()+"'"); 
  HttpURLConnection http = (HttpURLConnection) url.openConnection(); 
  http.connect(); 
  InputStream urlstream = http.getInputStream(); 
  BufferedReader l_reader = new BufferedReader(new InputStreamReader(urlstream)); 
  String currentLine=null;
  String totalstring=null;
  while ((currentLine = l_reader.readLine()) != null){
   totalstring += currentLine;
  }
  System.out.println("-------------"+totalstring);
  String target=null;
  if(totalstring.length()>1){
   target=totalstring.substring(4);
  }else{
   target=totalstring;
  }
  System.out.println(target);

你可能感兴趣的:(从另一个站点获取其返回值)