dcsimg
URLconnection
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Artur_Gajewski
Posted On:   Wednesday, May 1, 2002 10:20 PM

Hi, I'm trying to send parameters via HTTP-request to another server. I found this bit of code that I think does what I need it to do, but I'm not sure whether it actually is the code for sending HTTP-parameters. Can you tell me if this is right? Thanks! String params=("to=123456&msg=Hello World"); url = new URL("http://ipaddress:port/servlet"); conn=url.openConnection(); conn.setDoOutput(true); PrintWriter out = new PrintWriter(conn.getOutputStream()); InputStreamReader(conn.getInputStream())); out.print(params); out.flush(); out.close();    More>>

Hi,

I'm trying to send parameters via HTTP-request to another server. I found this bit of code that I think does what I need it to do, but I'm not sure whether it actually is the code for sending HTTP-parameters. Can you tell me if this is right? Thanks!

			
String params=("to=123456&msg=Hello World");
url = new URL("http://ipaddress:port/servlet");
conn=url.openConnection();
conn.setDoOutput(true);
PrintWriter out = new PrintWriter(conn.getOutputStream());
InputStreamReader(conn.getInputStream()));
out.print(params);
out.flush();
out.close();
   <<Less
About | Sitemap | Contact