URL url = new URL(urlstring.trim());
urlConnection = (HttpURLConnection) url.openConnection();
int response = urlConnection.getResponseCode();
解決辦法
需對url的parameter先作encode
String urlString = "http://test.com?param1=" + URLEncoder.encode(value1, "UTF-8") + "¶m2=" + URLEncoder.encode(value2, "UTF-8") ;
URL url = new URL(urlstring.trim());
urlConnection = (HttpURLConnection) url.openConnection();
int response = urlConnection.getResponseCode();
參考:
沒有留言:
張貼留言