asasdasd
asasdasd

Reputation: 33

HTTP GET request with parameters

Can someone tell me what a HTTP GET request with parameters looks like? I'm writing a program in C++ that sends the GET request to a website and gets a response.

I sent this string:

"GET / HTTP/1.1\r\nHost: "+url+"?"+key+"="+value+"\r\nConnection: close\r\n\r\n"

I dont know if this is the right string to send. And can someone give me a size with 1 parameter?

Upvotes: 1

Views: 2264

Answers (1)

timrau
timrau

Reputation: 23058

You should refer to HTTP 1.1 document.

It should at least look like

GET /?key=value HTTP/1.1
Connection: close
Content-length: 0
(empty line) 

The characters in URL after host name and port number should be written after the first space in the first line.

Upvotes: 1

Related Questions