CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: <FORM> POST/GET

  1. #1
    Guest

    <FORM> POST/GET

    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.


  2. #2
    Guest

    Re: <FORM> POST/GET

    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");


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured