I want to load html content from www.twitter.com/user in c/c++ without curl, what would the GET request look like? I connected on port 80(not https).
This is what I tried --> 'GET /user HTTP/1.1' but it didnt load the html, got a 400 bad request instead.
Error
HTTP/1.1 400 Bad Request
Date: Fri, 29 Jan 2016 10:46:16 GMT
Server: Apache
Content-Length: 226
Connection: close
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
</body></html>
3 Responses
Try adding the host field.
Otherwise check the standard to figure out when the server will send back a 400 error.
Hypertext Transfer Protocol -- HTTP/1.1
It's apparently malformed syntax, do you know what a full GET request looks like?
Check section 5.2 in the link to the RFC (the one in my original reply)
Share Your Thoughts