0

Well Been working with winsock2, and trying to send POST request to my server but currently no luck
with the packet header, so if anyone has a tutorial on how to do this with sprintf

code sample:

sprintf(Post_Request, "POST %s HTTP/2.0\r\n", Post_Request);
sprintf(Post_Request, "%sContent-Disposition: form-data; name=\"field1\"; text=\"%s\"\r\n", Post_Request,text.c_str());
sprintf(Post_Request, "%sContent-Disposition: form-data; name=\"submit\"\r\n", Post_Request);
sprintf(Post_Request, "%s\r\n", Post_Request);
sprintf(Post_Request, "%sSubmit Query\r\n\r\n", Post_Request);
sprintf(Post_Request, "%s\r\n", Post_Request);

When i run my code when connecting to server im getting error: "Bad Server Request" < I'm sure the http request i sent was bad.

I've seen code that people use packet sniffer to create a packet header, so im guessing this would be the easiest way to accomplish this >> tutorial + program to do this == would be best.

Thanks will check up here often.

Edited by Dani: Formatting

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by Ancient Dragon
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.