BOOL CTest::CheckUrl(CString &url)
{
HINTERNET hSession,hFile;// hRequest;
DWORD dwCodeLen;
DWORD dwStatusCode;
hSession=InternetOpen("InetURL:/1.0",INTERNET_OPEN_TYPE_PRECONFIG,NULL,NULL,0);
if(hSession)
{
hFile=InternetOpenUrl(hSession,url,NULL,0,INTERNET_FLAG_RELOAD,0);
dwCodeLen=10;
HttpQueryInfo(hFile,HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER,&dwStatusCode,&dwCodeLen,NULL);
if(200 == dwStatusCode) //HTTP_STATUS_OK=200 means The request completed successfully.
{
InternetCloseHandle(hFile);
InternetCloseHandle(hSession);
return TRUE;
}
}
return FALSE;
}
CheckUrl()
最新推荐文章于 2024-06-03 09:34:00 发布