熟悉HTTP协议的请进
std::string str = "GET /search.php?city=北京 HTTP/1.1\r\n"
"Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*\r\n"
"Accept-Language: zh-cn\r\n"
"Accept-Encoding: gzip, deflate\r\n"
"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)\r\n"
"Host: php.weather.sina.com.cn\r\n"
"Connection: Keep-Alive\r\n\r\n";
return ::send(_M_socket, str.c_str(), (int)str.length(), 0) == str.length();
发送后recv的数据为:
HTTP/1.0 503 Service Unavailable
Server: squid/2.6.STABLE13
Date: Wed, 16 Jul 2008 08:33:03 GMT
Content-Type: text/html
Cont
不知道为什么会返回错误503,动态网页不能用这种方式发送请求吗?