Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- #include <wininet.h>
- #pragma comment(lib, "Wininet")
- int main()
- {
- HINTERNET hInternet = 0, hRequest; //Открываем новое подключение с юзер агентом "CheatPack"
- hInternet = InternetOpenA("UserAgent", 0, 0, 0, 0);
- if (!hInternet)
- {
- std::cout << "Error: can't open connect" << std::endl;
- return -1;
- }
- hRequest = InternetOpenUrlA(hInternet, "https://prime-hack.net/test_ip.php?test=Connected", 0, 0, 0, 0); //Обращаемся по адресу
- if (!hRequest)
- {
- std::cout << "Error: can't send data" << std::endl;
- return -2;
- }
- if (!HttpSendRequestA(hRequest, NULL, 0, NULL, 0))
- {
- std::cout << "Error: can't get request" << std::endl;
- return -3;
- }
- //Читаем ответ от сервера
- char szData[64];
- memset(szData, 0, sizeof(szData));
- DWORD dwBytesRead;
- BOOL bRead = InternetReadFile(hRequest, szData, sizeof(szData) - 1, &dwBytesRead);
- if (dwBytesRead < 64)
- szData[dwBytesRead] = 0;
- if (!InternetCloseHandle(hInternet))
- {
- std::cout << "Error: can't close connect" << std::endl;
- return -4;
- }
- std::cout << std::endl << szData << std::endl << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement