i'm trying to download a zip file from a website, i think i have the request structured properly but there something wrong because when i try and open the file it says its an invalid arcive
here the code i have to send and recieve the data
Code:
case FD_READ:
{
FILE *in;
in = fopen("testing.zip","a+");
ret = recv(wParam,recved,sizeof(recved),0);
fprintf(in,recved);
fclose(in);
return TRUE;
}
case FD_WRITE:
{
char request[] = "GET /files/apps/htmlgen.zip HTTP/1.1\r\nHost: misdomain.tripod.com\r\nAccept: */*\r\nUser-Agent: Download Gopher/1.0\r\nPragma: no-cache\r\nCache-Control: no-cache\r\nConnection: close\r\n\r\n";
ret = send(wParam,request,strlen(request),0);
return TRUE;
}
when i view the file afterwards this is at the top
HTTP/1.1 200 OK
Date: Sun, 25 May 2003 02:09:25 GMT
Server: Squeegit/1.2.5 (3_sir)
Set-Cookie: CookieStatus=COOKIE_OK; path=/; domain=.tripod.com; expires=Mon, 24-May-2004 02:09:25 GMT
P3P: policyref="http://www.lycos.com/w3c/p3p.xml", CP="IDC DSP COR CURa ADMa DEVa CUSa PSAa IVAa CONo OUR IND UNI STA"
Set-Cookie: CookieStatus=COOKIE_OK; path=/; domain=.tripod.com; expires=Mon, 24-May-2004 02:09:25 GMT
Last-Modified: Sat, 17 May 2003 00:00:31 GMT
ETag: "a53702-989d-3ec57b9f"
Accept-Ranges: bytes
Content-Length: 39069
Connection: close
Content-Type: application/zip
so i delete that portion from the file and save it but it says its an invalid archive, can anyone see what i'm doing wrong