1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
int a=url.ReverseFind('/');
CString fichier;
fichier.Format("%s",url.Right(url.GetLength()-a-1));
CInternetSession Session("MySession");
CHttpConnection *HttpC=NULL;
CHttpFile *HttpF=NULL;
DWORD dwAccessType = PRE_CONFIG_INTERNET_ACCESS;
DWORD dwHttpRequestFlags =INTERNET_FLAG_KEEP_CONNECTION;
LPCTSTR pstrVerb = "GET";
LPCTSTR pstrReferer = NULL;
LPCTSTR pstrVersion = NULL;
LPCTSTR pstrAcceptTypes = NULL;
CString szHeaders= "Accept: */*rn";
LPCTSTR pstrUserName = NULL;
LPCTSTR pstrPassword = NULL;
DWORD dwFlags = NULL;
LPCTSTR pstrProxyName = NULL;
LPCTSTR pstrProxyBypass = NULL;
HttpC=Session.GetHttpConnection(url,80,pstrUserName,pstrPassword);
HttpF = HttpC->OpenRequest(pstrVerb, fichier, pstrReferer,1, &pstrAcceptTypes, pstrVersion, dwHttpRequestFlags);
HttpF->AddRequestHeaders(szHeaders);
bool info=HttpF->SendRequest(szHeaders);
if(info)
{
MessageBox(NULL,"Trouvé",MB_OK);
}else{
MessageBox(NULL,"Non Trouvé",MB_OK);
} |
Partager