Und so könnt ihr einen Post an eine Webseite senden....
Code
public void WebPOST(BufferedWriter wr, String host, String path, String send, String userAgent) throws IOException{
final String FIREFOX = "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6";
String dataflush = send;
int claenge = dataflush.length();
wr.write("POST "+path+" HTTP/1.1\r\n");
wr.write("Host: "+host+"\r\n");
wr.write("User-Agent: "+userAgent+"\r\n");
wr.write("Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n");
wr.write("Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3\r\n");
wr.write("Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n");
wr.write("Keep-Alive: 300\r\n");
wr.write("Connection: keep-alive\r\n");
wr.write("Content-Type: application/x-www-form-urlencoded\r\n");
wr.write("Content-Length: "+claenge+"\r\n");
wr.write("\r\n");
wr.write(dataflush);
wr.flush();
}
Alles anzeigen
Mfg