Incorrect Html Headers

Posts 15 of 5 · Page 1 of 1
Incorrect Html Headers
my program is sending html post/gets in an incorrect format?


Code:
	char postreq[3000];
	char parameters[100];
	sprintf(parameters, "/game/joinserver.jsp?user=%s&sessionId=%s&serverId=%s", username, sessionId, serverId);
	ZeroMemory(&postreq, sizeof(postreq));
	sprintf(postreq, "GET %s HTTP/1.1\r\n", parameters);
	sprintf(postreq, "%sConnection: keep-alive\r\n", postreq);
	sprintf(postreq, "%sUser-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2\r\n", postreq);
	sprintf(postreq, "%sHost: session.minecraft.net\r\n", postreq);
	sprintf(postreq, "%sContent-Type: application/x-www-form-urlencoded\r\n", postreq);
	sprintf(postreq, "%s\r\n", postreq);
	
	ZeroMemory(buf, strlen(buf));
	
	if(send(sessionsock, postreq, strlen(postreq), 0) == -1)
	{
		conout("error sending session data");
		WSACleanup();
		return WSAGetLastError();
	}
Hi again,

Why did you say in the previous post (http://www.mpgh.net/forum/31-c-c-pro...et-solved.html) "solved" if you are still having the same problem?

I think that you didn't even read the answers that people gave to your previous post, because the code was wrong and it's still wrong.

If you did a question, at least you should take care of spend a couple of minutes reading the answers you got, instead of asking the same question again and again. No?
actually it turned out the code was not wrong, and that problem was different then this one was.
i forgot a ? after the / in params..
if you are trying to parse an int into sprtinf,
%i or %d is your friend
%f for float
read above, and the varaibles oftenly contained numbers and letters. Ive since then finished it
Posts 15 of 5 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?