I'm making a program in python to get html from an url using an http request. I tried this using a page on a testwebserver I made for this, and it worked with this request:

```py
import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("localhost", 8080))
s.send(("GET / HTTP/1.1\r\nHost: localhost:8080").encode("utf8"))

x = s.recv(1024)
while not x:
    x = s.recv(1024)

print(x.decode("utf8"))

```

But when I try it on another site, it says bad request. How would I make this http valid for each site?
And how would I add get and post values in this?