简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM