Link to home
Start Free TrialLog in
Avatar of marchent
marchentFlag for Bangladesh

asked on

WININET POST Method

i have the below code that reads the HTML content from provided  URL.
///////////////////////////////////////////////////
#include<windows.h>
#include<wininet.h>
#include<stdio.h>
#pragma   comment(lib,"Wininet.lib")

char buffer[100*1024] ;

int main(int argc, char* argv[])
{
      HINTERNET hNet = ::InternetOpen("my browser",
                                PRE_CONFIG_INTERNET_ACCESS,
                                NULL,
                                INTERNET_INVALID_PORT_NUMBER,
                                0) ;

      HINTERNET hUrlFile = ::InternetOpenUrl(hNet,
                                "http://www.google.com/",
                                NULL,
                                0,
                                INTERNET_FLAG_RELOAD,
                                0) ;

      DWORD dwBytesRead = 0;
      BOOL bRead = ::InternetReadFile(hUrlFile,
                                                      buffer,
                                                      sizeof(buffer),
                                                      &dwBytesRead);
      
      // write the HTML response into the file
      FILE *fp = freopen("html.html","w",stdout);
      puts(buffer);
      fclose(fp);

      ::InternetCloseHandle(hUrlFile) ;

      ::InternetCloseHandle(hNet) ;
      return 0;
}
///////////////////////////////////////

above my code works for GET method, i need a workable code for POST method. example
url : http://www.myeeque.com/login/?
values : username = abc & password = abc123 & remember = 1

pls help if anyone know how to do this stuff.
ASKER CERTIFIED SOLUTION
Avatar of archang3l
archang3l
Flag of United Arab Emirates image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Consider using ServerXMLHTTP as an easier alternative too.
Avatar of marchent

ASKER

i'm not expert on mfc or such things, i need simple code like as i showed u on example. i have simplified above code from some other example, but your one i even failed to compile :( inside webaccess there are some header file those are missing as VS6.0 says.