The miner needs to send a POST http request to the server containing the authentication info and a json getwork struct and get the result like described by Zagitta.
The data field is a int (big endian ) , the first 20 integers are the actual block header that needs to be hased.
There are other 12 ints because it's the first step of the sha256 algo(pseudocode here http://en.wikipedia.org/wiki/SHA-2
). The midstate contains the a,b,c,d,e,f,g,h , registers of the sha256 transform after processing the first 512 bits chunk of data. Notice that for processing the first chunk , the nonce isn't needed, because it is contained in data (last int of the actual header) that's why is handful to have them , because you can calculate the hashes starting from that point (actually you can go some step further because the nonce is in position 19, the processing of the fist chunk finish on 15 , you can process positions 16 17 18 , and start each calculation from there) . Your goal is to find a nonce to be inserted in header for which sha256(sha256(header ) ) has a specified (by the difficulty ) number of final zero bits.
After finding the nonce you need to put it into the data field of the json sent by the server , put this data in a string , build a json getwork request , add to it a params array, put the string in the arra , send the json to the server. It will rely with an other json whose result field will be true if the solution was accepted.
I just finished writing my miner in c#.
I found really confusing the endianess of integers for the sha256 transform. The ints in data are represented as big endian hex strings. If you parse the string '000000ff'(big endia) it will return the int 0xff , that's written in memory as 0xff000000 (if you use windows or linux) BUT when you perform the arithmetical operations on that number , the operators work as that is a big endina number. So for instance if you have the number int num = 0x1 , it's written in memory as 0x80000000 , but if you write int res = num << 1 , you get res = 2, becase << operate on the big endian representation. This means that before doing your calculations you need to reverse the bytes of each int of the data array, because the sha256 transform requires to operate on little endian integers.