Advertisement
Guest User

Untitled

a guest
Feb 27th, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. HINTERNET hSession = InternetOpen( L"http generic", INTERNET_OPEN_TYPE_PRECONFIG,
  2. NULL, NULL, 0);
  3.  
  4. HINTERNET hConnection = InternetConnect(hSession, strIP,
  5. INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, NULL);
  6.  
  7. HINTERNET hRequest = HttpOpenRequest(hConnection, L"GET", sFormat, NULL, NULL, (LPCWSTR*) "*/*\0", 0, NULL);
  8. BOOL bReturn = HttpSendRequest(hRequest, NULL, 0, NULL, 0);
  9. char szReadBuffer[2048+1] = { NULL };
  10. DWORD dwRead = 0;
  11. CString strReturnData = L"";
  12. do {
  13. bReturn = InternetReadFile(hRequest, szReadBuffer, 2048, &dwRead);
  14. szReadBuffer[2048] = '\0';
  15. strReturnData += szReadBuffer;
  16. ZeroMemory(szReadBuffer, 2048);
  17. } while (dwRead != FALSE);
  18. InternetCloseHandle(hRequest);
  19. InternetCloseHandle(hConnection);
  20. InternetCloseHandle(hSession);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement