package FromApp;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URL;
import java.net.URLConnection;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class postRequ {

	//parm:请求的url链接  返回的是json字符串
		public static String getURLContent(String urlStr) {               
			//请求的url 
			URL url = null;      
		    //请求的输入流
		    BufferedReader in = null;   
			//输入流的缓冲
		    StringBuffer sb = new StringBuffer(); 
			try{
				url = new URL(urlStr);     
				in = new BufferedReader(new InputStreamReader(url.openStream(),"UTF-8") ); 
				String str = null;  
				//一行一行进行读入
				while((str = in.readLine()) != null) {
					sb.append( str );     
				}     
			} catch (Exception ex) {   
				            
			} finally{    
				try{
					if(in!=null) {
						in.close(); //关闭流    
				    }     
			    }catch(IOException ex) {      
				        
			    }     
			}     
		   String result =sb.toString();     
		   return result;    
		}  

}

使用方法:

String respoData=postRequ.getURLContent("http://www.………………");