You can use
                CHttpConnection* pServer = NULL;
                CHttpFile* pFile = NULL;

                pServer = session.GetHttpConnection("Your Server name",
nPort);

                        pFile
=pServer->OpenRequest(CHttpConnection::HTTP_VERB_POST,
_T("servlet/GTUserLogin"));

                        bRet=pFile->AddRequestHeaders(strHeaders);

pFile->SendRequest(strHeaders,strHeaders.GetLength(),(LPVOID)(LPCTSTR)strFor
mData, strFormData.GetLength());


where GTUserLogin is the name of the servlet
and
CString strHeaders =
      _T("Content-Type: application/x-www-form-urlencoded");

CString strFormData = _T("username=adrian&password=adrian");

In strFormData you can send the firm data in URL Encoded format


Hope this helps
Tushar
        ----------
        From:  Kevin Mukhar [SMTP:[EMAIL PROTECTED]]
        Sent:  May 08, 2000 8:15 AM
        To:  [EMAIL PROTECTED]
        Subject:  Re: servlets and c

        Sebasti�n Germ�n Moreno wrote:
        >
        > Does anyone know how can I send parameters in a POST to a servlet?

        Not sure how your VC++ code needs to look, but you need to send the
POST data as
        a string after all the header information. Here is the general form
of a POST
        request:

        Method URI HTTP-version  //method is POST
        General-header           //replace with specific header
        Request-header
        Entity-header
                                 //blank line between header and body
        Entity-body              //name=value pairs, i.e.,
        name1=value1&name2=value2&name3=value3

        The information above is from Web Client Programming, Wong, O'Reilly
1997

        You can get more detail from the HTTP specification
        ftp://ftp.isi.edu/in-notes/rfc1945.txt. Section 5 details the format
shown
        above.

        Other HTTP specs are ftp://ftp.isi.edu/in-notes/rfc2616.txt and
        ftp://ftp.isi.edu/in-notes/rfc2617.txt


___________________________________________________________________________
        To unsubscribe, send email to [EMAIL PROTECTED] and include in
the body
        of the message "signoff SERVLET-INTEREST".

        Archives:
http://archives.java.sun.com/archives/servlet-interest.html
        Resources:
http://java.sun.com/products/servlet/external-resources.html
        LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to