java - Post with HTTPUrlConnection -


i'm using httpurlconnection connect web service have form , button.

the part in source code is:

    <form action="main.php4?page=markt3art=uin=484504321483db0fc35d1e8e660b99c8&x=&y=filled=1" method="post">         <input type="hidden" value="" name="p"></input>         <input type="hidden" value="1755219" name="buy2f8d0"></input>         <input type="hidden" value="1755219" name="buy"></input>         <input type="text" value="323" size="9" maxlength="16" name="teilkauf"></input>         <img width="1" hspace="20" height="1" src="pics/leer.gif"></img>         <input class="send" type="submit" value=" buy "></input>     </form> 

what i'm doing is: (www website http:// ...)

            url url = new url(www);             httpurlconnection conexion = (httpurlconnection)url.openconnection();             string forsending = "1";             string charset = "utf-8";              string stringtosend = urlencoder.encode(forsending, charset);              conexion.setdooutput(true);             conexion.setrequestmethod("post");             outputstreamwriter out = new outputstreamwriter(             conexion.getoutputstream());              out.write("teilkauf=" + stringtosend);             out.flush();             out.close(); 

but doesn't work. help? thank you.

you have make post request form's action, not site form located.

form front-end backend server, when click submit browser builds request action.

so instead of posting form's location post main.php4?page=markt3art=uin=484504321483db0fc35d1e8e660b99c8&x=&y=filled=1


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -