Click to See Complete Forum and Search --> : <FORM> POST/GET


May 26th, 1999, 07:50 AM
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.

August 19th, 1999, 10:31 AM
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-&gt;OpenRequest(CHttpConnection::HTTP_VERB_POST, "Readmedn.htm");
BOOL result = pFile-&gt;SendRequest(strHeaders,
(LPVOID)(LPCTSTR)strFormData, strFormData.GetLength());


if ( result)
AfxMessageBox("success");