marchent
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_NUMB ER,
0) ;
HINTERNET hUrlFile = ::InternetOpenUrl(hNet,
"http://www.google.com/",
NULL,
0,
INTERNET_FLAG_RELOAD,
0) ;
DWORD dwBytesRead = 0;
BOOL bRead = ::InternetReadFile(hUrlFil e,
buffer,
sizeof(buffer),
&dwBytesRead);
// write the HTML response into the file
FILE *fp = freopen("html.html","w",st dout);
puts(buffer);
fclose(fp);
::InternetCloseHandle(hUrl File) ;
::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.
//////////////////////////
#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_NUMB
0) ;
HINTERNET hUrlFile = ::InternetOpenUrl(hNet,
"http://www.google.com/",
NULL,
0,
INTERNET_FLAG_RELOAD,
0) ;
DWORD dwBytesRead = 0;
BOOL bRead = ::InternetReadFile(hUrlFil
buffer,
sizeof(buffer),
&dwBytesRead);
// write the HTML response into the file
FILE *fp = freopen("html.html","w",st
puts(buffer);
fclose(fp);
::InternetCloseHandle(hUrl
::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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Consider using ServerXMLHTTP as an easier alternative too.
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.