submission with POST

Discussion about the puzzle system.
Post Reply
User avatar
adum
Posts: 392
Joined: Thu Apr 19, 2007 12:49 pm
Contact:

submission with POST

Post by adum »

the puzzles will now accept HTTP POST requests for automated problem submissions. use the same vars as for the GETs. (this first cropped up with Mortal Coil, level 437 -- nasty one.)

adum
hackerssmart
Posts: 2
Joined: Fri Jan 22, 2010 5:53 pm

Re: submission with POST

Post by hackerssmart »

ken.1608, hello
kudo shinichi
JanB
Posts: 8
Joined: Fri Nov 28, 2008 5:32 pm

Post by JanB »

The POST-Sbmission seems to be broken. All the Data I submit is ignored. I test it with a test script on my own Server and it received my data, so my program seems to be ok.
Tenebrar
Posts: 18
Joined: Sun Jan 13, 2008 1:38 pm

Post by Tenebrar »

How would you do a POST request in java? I'm at level 92 of crossflip, and my code no longer seems to work:

URL u;
u = new URL("http://www.hacker.org/cross/index.php?name=" + $name + "&password=" + $password + "&sol=" + sol);
InputStream is = u.openStream();
BufferedReader in = new BufferedReader(new InputStreamReader(is));

String line;
while ((line = in.readLine()) != null)
{
System.out.println(line);
}
is.close();
User avatar
bodjo
Posts: 37
Joined: Sat Feb 26, 2011 9:27 am
Location: tunisia

Post by bodjo »

compudemon
Posts: 33
Joined: Sat Aug 13, 2011 2:13 pm

after many trys i got post method working

Post by compudemon »

this is the solution posting section of the solver code in Java. it should be easy to adapt this to any game here, just change the url address and the writer.write line with '&' separated key/value pairs like a get line would have. i tried other examples but seems the page here was ignoring me till i added the content-type.

Code: Select all

public boolean solve() throws Exception {
   URL u;
   String path = findSolutionPath();
   System.out.println("solved at (" + startX + ", " + startY
            + ") : " + path);
   String enc="UTF-8";
   u = new URL("http://www.hacker.org:80/coil/index.php");
   URLConnection conn=u.openConnection();
   conn.setDoOutput(true);
   conn.setRequestProperty("Content-Type", 
            "application/x-www-form-urlencoded");        
   OutputStreamWriter writer=new
            OutputStreamWriter(conn.getOutputStream());
   writer.write("name=" + URLEncoder.encode(name, enc) + 
            "&password=" + URLEncoder.encode(pw, enc) + 
            "&path=" + path + "&x=" + startX + "&y=" + startY);
   writer.flush();
   BufferedReader rd = new BufferedReader(new
            InputStreamReader(conn.getInputStream()));
   rd.readLine();
   writer.close();
   rd.close();
   return false;
}
Post Reply