首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ Builder >

TIdMultiPartFormDataStream TIDHTTP的参数有关问题

2013-12-13 
TIdMultiPartFormDataStream TIDHTTP的参数问题?代码如下,利用TIDHTTP和TIdMultiPartFormDataStream post

TIdMultiPartFormDataStream TIDHTTP的参数问题?
代码如下,利用TIDHTTP和TIdMultiPartFormDataStream post参数

para = “aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa”;
TIdMultiPartFormDataStream *stream = new TIdMultiPartFormDataStream();

try{
stream->AddFormField("method",method);
stream->AddFormField("timestamp",timestampStr);
stream->AddFormField("para",para);

stream->Position = 0;
IdAntiFreeze1->OnlyWhenIdle = false;
IdHTTP1->Request->ContentType = "multipart/form-data";
IdHTTP1->Post("http://127.0.0.1//index.php",stream));

}__finally{
delete stream;
}
利用抓包工具查看,发现自动添加了“=”(70个自己就添加一个)
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa=
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa=
aaaaaaaaaaa
tidhttp c++Builder tidmultipartDataS
[解决办法]
多加两个参数试试:

stream->AddFormField("para", para, "iso-8859-1", "8bit");

热点排行