char url[] = "/pic.aspx?rand=143"; char host[] = "sms.mts.ru"; sprintf( request, "GET %s HTTP/1.1\r\nAccept: image/png, image/gif\r\nHost: %s\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\nAccept: image/gif\r\n\r\n", url, host );
HTTP/1.1 200 OK Date: Thu, 28 Feb 2008 17:40:57 GMT Server: Microsoft-IIS/6.0 Compression-Control: whitespace X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 Pragma: no-cache Set-Cookie: ASP.NET_SessionId=f3gyvfetrwl3xvua3wl5rzff; path=/; HttpOnly Cache-Control: no-cache Pragma: no-cache Expires: -1 Content-Type: image/gif Content-Length: 3726 GIF89aМ320
unsigned int x; while((len=recv( s, buf, 32*10, 0))>0){ fout.open("C:/1.gif",ios::binary | ios::app); fout.write(buf,len); x+=len; fout.close(); } cout<<x<<endl;