http - Failing to connect to a web server with Java -


i got strange task: connect webserver using java though i'm php programmer. used program java @ university it's been few years since.

i took code sample stack-overflow. runs fine, no compilation errors no exceptions, but, don't see outgoing connection when sniff fiddler, , server side script doesn't see incoming connections either.

any ideas of can wrong? or, how debug situation?

string urlparameters = "param1=a&param2=b&param3=c"; string request = "http://example.com/index.php"; url url = new url(request);  httpurlconnection connection = (httpurlconnection) url.openconnection();            connection.setdooutput(true); connection.setdoinput(true); connection.setinstancefollowredirects(false);  connection.setrequestmethod("post");  connection.setrequestproperty("content-type", "application/x-www-form-urlencoded");  connection.setrequestproperty("charset", "utf-8"); connection.setrequestproperty("content-length", "" + integer.tostring(urlparameters.getbytes().length)); connection.setusecaches (false);  dataoutputstream wr = new dataoutputstream(connection.getoutputstream ()); wr.writebytes(urlparameters); wr.flush(); wr.close(); connection.disconnect(); 


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

c++ - End of file on pipe magic during open -