Constructing HTTP POST Url parameters
Article Metadata
This article shows how to send parameters along with the URL in an HTTP POST.
Consider that a web server needs some parameters for e.g.
// URL for POST request.
_LIT8(KPostUri, "http://mysite.net/test/update");
The following parameters need to be posted to the above URL, username/password
_LIT8(KPostParamName1, "username");
_LIT8(KPostParamName2, "password");
This can be done using the HTTP Client with form encoder using class CHTTPFormEncoder
//Construction
iFormEncoder = CHTTPFormEncoder::NewL();
In the POST request:
void CHTTPExampleEngine::PostRequestL(const TDesC& aUsername,const TDesC& aPassword)
{
TBuf8<50> iTemp;
TBuf8<50> iTemp2;
iTemp.Copy(aUsername);
iTemp2.Copy(KPostParamName1);
iFormEncoder->AddFieldL(iTemp2,iTemp);
iTemp.Copy(aPassword);
iTemp2.Copy(KPostParamName2);
iFormEncoder->AddFieldL(iTemp2,iTemp);
....
....
iTransaction.Request().SetBody(*iFormEncoder);
iTransaction.SubmitL();
}
Remember the following:
_LIT8(KUserAgent, "HTTPExample (1.0)"); // Name of this client app
_LIT8(KAccept, "text/*");// Accept any (but only) text content
_LIT8(KPostParamName1, "username");//Name of the parameter in a POST request
_LIT8(KPostParamName2, "password");
_LIT8(KPostContentType, "text/*");//Content type sent in a POST request
_LIT8(KContentTypeForm, "application/x-www-form-urlencoded\0");


12 Sep
2009
This article had illustrate about how to contruct http post url parameters here in this article they had explained about clearly by taking an example
Before that We have to know what is http means hypertext transfer protocal if we want to get or post some thing from the mobile to webserver we are using this protocal and we use some methods like get and post ,get is for getting data in webserver and post is used to make connection with the webserver and mobiles
so these article is very help full to beginners who would like to do web based projcets even i am doing web based projects it will help you.