C
Chris Malumphy
I need to post a string from a java applet to my server. Can this be
done? I have been fooling around with the following code. But frankly I
don't know what I'm doing and could use some help. My applet will
generate a string that I want to send to my script which will append it
to a file. Any help would be appreciated.
public boolean SendInfo(stringtosend)
{
String s1 = "POST /cgi-bin/myform.pl";
Socket http = new Socket("www.mysite.com", 80);
OutputStream os = http.getOutputStream();
try
{
PrintStream ps = new PrintStream(s1);
ps.println("POST /cgi-bin/websearch.pl");
ps.println("Content-type: plain/text");
String data = stringtosend;
ps.println("Content-length: " + data.length + "\n");
ps.println(data);
}
catch (Exception e)
return(false);
return(true);
}
done? I have been fooling around with the following code. But frankly I
don't know what I'm doing and could use some help. My applet will
generate a string that I want to send to my script which will append it
to a file. Any help would be appreciated.
public boolean SendInfo(stringtosend)
{
String s1 = "POST /cgi-bin/myform.pl";
Socket http = new Socket("www.mysite.com", 80);
OutputStream os = http.getOutputStream();
try
{
PrintStream ps = new PrintStream(s1);
ps.println("POST /cgi-bin/websearch.pl");
ps.println("Content-type: plain/text");
String data = stringtosend;
ps.println("Content-length: " + data.length + "\n");
ps.println(data);
}
catch (Exception e)
return(false);
return(true);
}