need help to modify my code, about using socket in windows to read web page.
Hi, Im new here, need a help.
this works:
Code:
char host[] = "www.google.com";
char *request = "GET / HTTP/1.0\r\nHost: www.google.com\r\nConnection: Close\r\n\r\n";
struct hostent *hp; // will keep the same
hp = gethostbyname(host); // will keep the same
ret = send(sock, request, strlen(request), 0); // will keep the same
both below 2 not working, who can make it work:
Code:
char host[] = "news.google.com/nwshp?hl=en&tab=wn&authuser=0";
char *request = "GET / HTTP/1.0\r\nHost: news.google.com/nwshp?hl=en&tab=wn&authuser=0\r\n\r\n";
Code:
char host[] = "news.google.com";
char *request = "GET / HTTP/1.0\r\nHost: news.google.com/nwshp?hl=en&tab=wn&authuser=0\r\n\r\n";