首先这是第一次发,有错误之处勿喷哈。
再次,在C++Builder 10.4使用indy控件时发现资源比较少,要不就是要掏几mao。索性自己研究了一下,测试没有遇到什么问题,如下代码供您参考,(有改进的地方,可以的话也回我一下。谢谢)
AnsiString Temp_A = "";
TStringStream* Request = NULL;
TStringStream* rev = NULL;
Request = new TStringStream();
rev = new TStringStream();
Request->Clear();
rev->Clear();
Request->WriteString(_T("kkkkkkjjjjjjksjflkjsf32165465"));
IdHTTP1->Post("http://httpbin",Request,rev);
if(rev!=NULL)
Edit1->Text=rev->DataString;
Request->WriteString(_T("Hello,This is english !"));
IdHTTP1->Post("http://httpbin",Request,rev);
if(rev!=NULL)
Edit2->Text =rev->DataString;
Request->WriteString(_T("你好,这是简体中文"));
IdHTTP1->Get("http://httpbin",Request);
Edit3->Text =Request->DataString;
Request->WriteString(_T("哈嘍,這是繁體中文"));
IdHTTP1->Get("http://httpbin",Request);
Edit4->Text = Request->DataString;
?
控件使用的TidHTTP, 分别用IdHTTP1->Post & IdHTTP1->Get进行提交数据。如下图片是返回过来的数据,
|