try
{
URL url = new URL("http://www.diankongyixian.com/WBWX/UI/DataServices/IDataServicesForWeChat.ashx") ;
connection = (HttpURLConnection) url.openConnection() ; //根据URL生成HttpURLConnection
connection.setRequestMethod("GET");// 默认GET请求
connection.connect();// 建立TCP连接
if (connection.getResponseCode() == HttpURLConnection.HTTP_OK)
{
reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
StringBuilder result = new StringBuilder();
// 循环读取流
while ((line = reader.readLine()) != null)
{
result.append(line).append(System.getProperty("line.separator"));// "\n"
}
System.out.println(result.toString());
}
}
连接时 getResponseCode 一直返回400, 跟踪进去发现是 如图片的错误
,
那位高手知道怎么解决么?谢谢