2024年3月13日发(作者:)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

/**

* 通过HttpUrlConnection来get请求数据

*

* @param url

* @return result

*/

public static String getByHttpUrlConn(String requestUrl) {

StringBuffer strBuf;

strBuf = new StringBuffer();

try {

URL url = new URL(requestUrl);

URLConnection conn = nnection();

BufferedReader reader = new BufferedReader(new InputStreamReader(utStream(), "utf-8"));// 转码。

String line = null;

while ((line = ne()) != null)

(line + " ");

();

} catch (MalformedURLException e) {

tackTrace();

} catch (IOException e) {

tackTrace();

}

return ng();

}

通过HttpUrlConnection来POST数据