HTTP POST works on browser but not socketically

I can post info using a simple html but i cant post using sockets..

[code][

InetAddress addr = InetAddress.getByName(hostname);

Socket socket = new Socket(addr, port);

String path = postpath;

BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), "UTF8"));

wr.write("POST "+path+" HTTP/1.0\r\n");

wr.write("Content-Length: "+data.length()+"\r\n");

wr.write("Content-Type: application/x-www-form-urlencoded\r\n");

wr.write("\r\n");

wr.write(data);

wr.flush();

BufferedReader rd = new BufferedReader(new InputStreamReader(socket.getInputStream()))

/code]

it works on my local web server but not on the remote web server. what could be the problem and explanation?

[785 byte] By [Aldricha] at [2007-11-26 21:41:47]
# 1

100% right way is to catch request from browser and create your our in same way. Completely except content length and content itself :)

If you can't then try to:

add Host field

add Cookies if present

add Referer

add User-Agent

Some clever servers check all these fields for some reasons (prevent silly attacks for example and successfully as I can see...)

Then ask again.

One more - are you sure you use correct content format? And last - how do you know it doesn't work with remote server? Exactly?

Michael.Nazarov@sun.coma at 2007-7-10 3:27:32 > top of Java-index,Core,Core APIs...