Solved HTTP GET error

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

user123

Newbie
Full Member
Jul 8, 2014
17
142
0
Im trying to send a HTTP GET request to my own webserver, and hopefully recieve information that is returned.
It works fine , UNTIL the HttpQueryInfo part, there it errors.
It says something about cannot find header, I have no idea what that means.
Code:
C++:
void HttpGetRequestFunc(void)
{
	HINTERNET open = InternetOpen("Lollerskates 2.0", NULL, NULL, NULL, NULL);
	if (open != NULL)
	{
		cout << "InternetOpen success." << endl;
	}
	else
	{
		cout << "InternetOpen error: " << GetLastError() << endl;
	}

	HINTERNET connect = InternetConnect(open, "paperclip.netai.net", INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, NULL, NULL);
	if (connect != NULL)
	{
		cout << "InternetConnect success." << endl;
	}
	else
	{
		cout << "InternetConnect error: " << GetLastError() << endl;
	}


	HINTERNET request = HttpOpenRequest(
		connect,
		NULL,
		"/test.php?data=blablabla",
		NULL,
		NULL,
		NULL,
		NULL,
		NULL
		);

	if (request != NULL)
	{
		cout << "request succesful" << endl;
	}
	else
	{
		cout << "Request error:" << GetLastError() << endl;
	}
	string buffer[60];

	DWORD len = 1024;
	DWORD header = 1024;

	BOOL GetInfo = HttpQueryInfo(
		request,
		NULL,
		&buffer,
		&len,
		&header
		);
	
	if (GetInfo == false)
	{
		string bla[1];
		bla[0] = buffer[0];
		cout << "Buffer: " << bla << endl;
		cout << "HttpQueryInfo Error:" << GetLastError() << endl;
		//ERROR_HTTP_HEADER_NOT_FOUND wtf?
	}
	else
	{
		cout << "Works!" << endl;
	}
	InternetCloseHandle(open);
	InternetCloseHandle(connect);
}
Screenie:
skate1.PNG
 

NTvalk

Hacker
Meme Tier VIP
Jul 6, 2013
499
3,108
8
have you tried looking at this example from msdn
C++:
// Retrieving Headers Using a Constant
BOOL SampleCodeOne(HINTERNET hHttp)
{
   LPVOID lpOutBuffer=NULL;
   DWORD dwSize = 0;

retry:

   // This call will fail on the first pass, because
   // no buffer is allocated.
   if(!HttpQueryInfo(hHttp,HTTP_QUERY_RAW_HEADERS_CRLF,
      (LPVOID)lpOutBuffer,&dwSize,NULL))
   {
      if (GetLastError()==ERROR_HTTP_HEADER_NOT_FOUND)
      {
         // Code to handle the case where the header isn't available.
         return TRUE;
      }
      else
      {
        // Check for an insufficient buffer.
        if (GetLastError()==ERROR_INSUFFICIENT_BUFFER)
        {
            // Allocate the necessary buffer.
            lpOutBuffer = new char[dwSize];

            // Retry the call.
            goto retry;
        }
        else
        {
            // Error handling code.
            if (lpOutBuffer)
            {
               delete [] lpOutBuffer;
            }
            return FALSE;
        }
      }
   }

   if (lpOutBuffer)
   {
      delete [] lpOutBuffer;
   }

   return TRUE;
}
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods