"how to make a get request over socket c" Code Answer's
You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "how to make a get request over socket c" answered properly. Developers are finding an appropriate answer about how to make a get request over socket c related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like how to make a get request over socket c. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on how to make a get request over socket c.
how to make a get request over socket c
char sendline[MAXLINE + 1], recvline[MAXLINE + 1];
char* ptr;
size_t n;
/// Form request
snprintf(sendline, MAXSUB,
"GET %s HTTP/1.0\r\n" // POST or GET, both tested and works. Both HTTP 1.0 HTTP 1.1 works, but sometimes
"Host: %s\r\n" // but sometimes HTTP 1.0 works better in localhost type
"Content-type: application/x-www-form-urlencoded\r\n"
"Content-length: %d\r\n\r\n"
"%s\r\n", page, host, (unsigned int)strlen(poststr), poststr);
/// Write the request
if (write(sockfd, sendline, strlen(sendline))>= 0)
{
/// Read the response
while ((n = read(sockfd, recvline, MAXLINE)) > 0)
{
recvline[n] = '\0';
if(fputs(recvline, stdout) == EOF)
{
printf("fputs() error\n");
}
/// Remove the trailing chars
ptr = strstr(recvline, "\r\n\r\n");
// check len for OutResponse here ?
snprintf(OutResponse, MAXRESPONSE,"%s", ptr);
}
}
Source: stackoverflow.com
All those coders who are working on the Whatever based application and are stuck on how to make a get request over socket c can get a collection of related answers to their query. Programmers need to enter their query on how to make a get request over socket c related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about how to make a get request over socket c for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of how to make a get request over socket c while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "how to make a get request over socket c". Visit this developer's friendly online web community, CodeProZone, and get your queries like how to make a get request over socket c resolved professionally and stay updated to the latest Whatever updates.