Board index » delphi » downloading a file using WinInet
Bill N
Delphi Developer |
downloading a file using WinInet2004-07-22 12:06:13 AM delphi137 I'm trying to download a file using http. However, httpQueryInfo returns false all the time. I am using this code for testing: ================================================= hSession := InternetOpen( PChar('SomeAgent'), INTERNET_OPEN_TYPE_PRECONFIG, Nil, Nil, 0 ); hConnect := InternetConnect( hSession, PChar('127.0.0.1'), INTERNET_DEFAULT_HTTP_PORT, nil,nil, INTERNET_SERVICE_HTTP, 0, 0 ); RequestMethod := 'GET'; InternetFlag := INTERNET_FLAG_RELOAD; AcceptType := PChar('Accept: */*'); hRequest := HttpOpenRequest(hConnect, RequestMethod, PChar('httpDownload/Downloads/AutoUpdats/8/updates.xml'), 'HTTP/1.0' , PChar(''), @AcceptType, InternetFlag, 0 ); HttpSendRequest( hRequest, Nil, 0, Nil, 0 ); BufferLength := 1024; GetMem(Buffer, BufferLength); FDownloadResult := HttpQueryInfo(hRequest, HTTP_QUERY_CONTENT_LENGTH, Buffer, BufferLength, Index ); ================================================= I can not seem to find any info on httpQueryInfo either for debugging purposes. Can anyone point me to some info on httpQueryInfo or what's wrong with my code. Thanks, Bill N |