Step1:
call GetFTPFile("http://www.speedace.info.jpg");
In the GetFTPFile function
void GetFTPFile(CString csPath)
{
CInternetSession csiSession;
DWORD dwServiceType = 0;
CString sServerName, sObject,csData;
INTERNET_PORT nPort; CString csTemp;
CString sGetFromURL; //( _T("") );
sGetFromURL =csQuery;
if ( !AfxParseURL ( sGetFromURL, dwServiceType, sServerName, sObject, nPort ) )
throw;
CHttpConnection* pHTTPServer = NULL;
pHTTPServer = csiSession.GetHttpConnection ( sServerName, nPort );
CHttpFile* pFile = NULL;
pFile = pHTTPServer->OpenRequest ( CHttpConnection::HTTP_VERB_GET, sObject, NULL, 1, NULL, NULL, INTERNET_FLAG_RELOAD );
pFile->SendRequest();
TCHAR sRaw [1024];
memset(sRaw,0,1024);
long lt = 0;
CFile fil;
CFileException fe;
int n = fil.Open("d:\\sen.jpg", CFile::modeWrite || CFile::typeBinary ,&fe );
while ( pFile->Read ( sRaw, 1024 ) )
{
fil.Write(sRaw,1024);
memset(sRaw,0,1024);
}
fil.Close();
pFile->Close();
pHTTPServer->Close();
}
Friday, August 14, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment