How do I get the information from a post/get operation from a form? I know how in HTML, I need to get this info in an MFC app that uses the imbedde browser in a view. I want to pass this information to the pareant window.
Printable View
How do I get the information from a post/get operation from a form? I know how in HTML, I need to get this info in an MFC app that uses the imbedde browser in a view. I want to pass this information to the pareant window.
try this. Use GET/POST in openrequest function.
Mahesh
=================
CInternetSession session;
CHttpConnection* pConnection = NULL;
CHttpFile* pFile1 = NULL;
char* buffer = new char[MAXBUF];
UINT nBytesRead = 0;
DWORD dwStatus;
CString g_strServerIP ;
CString g_strServerName = "localhost" ;
int g_nPort = 80 ;
// username/password doesn't work yet
if(!g_strServerName.IsEmpty()) {
pConnection = session.GetHttpConnection(g_strServerName,
(INTERNET_PORT) g_nPort);
}
else {
pConnection = session.GetHttpConnection(g_strServerIP,
(INTERNET_PORT) g_nPort);
}
CString strHeaders =
_T("Content-Type: application/x-www-form-urlencoded");
// URL-encoded form variables -
// name = "John Doe", userid = "hithere", other = "P&Q"
CString strFormData = _T("name=John+Doe&userid=hithere&other=P%26Q");
CHttpFile* pFile =
pConnection->OpenRequest(CHttpConnection::HTTP_VERB_POST, "Readmedn.htm");
BOOL result = pFile->SendRequest(strHeaders,
(LPVOID)(LPCTSTR)strFormData, strFormData.GetLength());
if ( result)
AfxMessageBox("success");