0

I'm trying to get the html code of webpage and check the value of this code. I have this code, it not have errors but it not works, I want that if the code of the web its for example "test", the program do an action. But now the program don do anything. There is my code:

void GetPage()
{
   std::string check_command_link = ("test.php?HWID=" + name()); 
    HINTERNET hInternet = InternetOpenA("InetURL/1.0", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
    HINTERNET hConnection = InternetConnectA(hInternet, "127.0.0.1", 80, " ", " ", INTERNET_SERVICE_HTTP, 0, 0);
    HINTERNET hData = HttpOpenRequestA(hConnection, "GET", check_command_link.c_str(), NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
    char buf[2048];
    string lol;
    HttpSendRequestA(hData, NULL, 0, NULL, 0);

    DWORD bytesRead = 0;
    DWORD totalBytesRead = 0;
    while (InternetReadFile(hData, buf, 2000, &bytesRead) && bytesRead != 0)
    {
        buf[bytesRead] = 0;
        lol = lol + buf;
        if (buf == "test") {
            //DO AN ACTION
            printf("Content;Test");
       }
        totalBytesRead += bytesRead;
    }

    InternetCloseHandle(hData);
    InternetCloseHandle(hConnection);
    InternetCloseHandle(hInternet);
}

Thanks!

0 Answers0