Hello,

I am trying to send a request via HTTP Post. The session and transaction are created and submitted correctly, as I do execute a php script waiting on a www server. However, the structure of the request body seems to be incorrect, as I can't read POST variables in my script. When I send the request via web browser everything is correct, so the problem is in my code.

I've read and used the HTTP Client Example, but they don't construct a Post request there, they leave it to the user submitting the data using GUI.

Here's how I construct the request body (it's for testing purposes only):

delete iPostData;
TBuf8<1024> tmp;
_LIT8(KPost1, "--------------1345234fsf342\n");
_LIT8(KPost2, "Content-Disposition: form-data; name=\"latitude\"\n\n");
_LIT8(KPost3, "22.5");
_LIT8(KPost4, "--------------1345234fsf342--");
tmp.Copy(KPost1);
tmp.Append(KPost2);
tmp.Append(KPost3);
tmp.Append(KPost4);

iPostData = tmp.AllocL();

_LIT8(KUrl, "http://myscript.com");
TUriParser8 uri;
uri.Parse(KUrl);

RStringF method = iSession.StringPool().StringF(HTTP::EPOST,
RHTTPSession::GetTable());

iTransaction = iSession.OpenTransactionL(uri, *this, method);

_LIT8(KUserAgent, "MyClient");
_LIT8(KAccept, "*/*");
_LIT8(KMimeType, "multipart/form-data; boundary =--------------1345234fsf342");

RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection();
SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
SetHeaderL(hdr, HTTP::EAccept, KAccept);
SetHeaderL(hdr, HTTP::EContentType, KMimeType);

MHTTPDataSupplier* dataSupplier = this;
iTransaction.Request().SetBody(*dataSupplier);

// Submit the transaction. After this the framework will give transaction
// events via MHFRunL and MHFRunError.
iTransaction.SubmitL();

/////

GetNextDataPart(TPtrC8 &aDataPart)
{

aDataPart.Set(iPostData->Des());

return ETrue;

}


Can you see any errors?

Maciej