-4

I have Json text:

{"searchParams":{"cnt":5,"Bounds":{"NorthEast": "Latitude":"48.5166043488675","Longitude":"-67.5"},"SouthWest":{"Latitude":"25.7207351344121","Longitude":"-126.38671875"}},"HomesAvailableNow":[0],"BrandId":[4]}}

I have url = http://www.mypage.com/AjaxWebServices/MapService.asmx/FilterByQueryString and I want to post request and receive data.

please help me...

ScottJShea
  • 7,041
  • 11
  • 44
  • 67
paraguma
  • 187
  • 1
  • 1
  • 7

1 Answers1

2

Use URLConnection to post data:

String data = "json";

URL url = new URL(urlString);
URLConnection conn;
conn = url.openConnection();
conn.setDoOutput(true);
conn.setDoInput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush(); 
// Get the response 
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); 
String line; 
while ((line = rd.readLine()) != null) { 
    // Process line... 
    } 
wr.close(); 
rd.close(); 
return rd.toString();
Tapas Bose
  • 28,796
  • 74
  • 215
  • 331