Home > Back-end >  IDHTTP GET submitted data failed
IDHTTP GET submitted data failed

Time:09-22

http://lxdq.cai-yun.net/service.php/API/Order/generate_order? The OrderNum=124834931 & amp; Datetime=1224834931 & amp; The Customer=zhang SAN & amp; Phone=18871216316 & amp; Address=zhang sanfeng road & amp; The Appointment=1224834931 & amp; Remark % 20=send support & amp; [{ItemList="Item" : "hisense TV", "Qty" : "2", "ItemType" : "2", "Distribution" : "1", "Installation" : "30"}]
Utf-8 code, test in IE, successfully submit data, but failed to submit data in Delphi, urgent for warrior grant instruction! The code is as follows:
Var
HttpClient: TIdHttp;
ParamList: TStringList;
SS: TStringStream;
S: a string;
The begin
SS:=TStringStream. Create;
S:=Edit13. Text + 'OrderNum' + '=' + Edit1. Text + '& amp; '
+ 'Datetime' + '=' + Edit2. Text + '& amp; '
+ 'Customer' + '=' + Edit3. Text + '& amp; '
+ 'Phone' + '=' + Edit4) Text + '& amp; '
+ 'Address' + '=' + Edit5. Text + '& amp; '
+ 'Appointment' + '=' + Edit6. Text + '& amp; '
+ 'Remark' + '=' + Edit7. Text + '& amp; '
[' + 'ItemList=' + '
{' + + '
CRH (34) + 'Item' + CRH (34) + ', '+ CRH (34) + Edit8. Text + CRH (34) +', '+
CRH (34) + 'Qty + CRH (34) +', '+ CRH (34) + Edit9. Text + CRH (34) +', '+
CRH (34) + 'ItemType + CRH (34) +', '+ CRH (34) + Edit10. Text + CRH (34) +', '+
CRH (34) + 'Distribution' + CRH (34) + ', '+ CRH (34) + Edit11. Text + CRH (34) +', '+
CRH (34) + 'Installation + CRH (34) +', '+ CRH (34) + Edit12. Text + CRH (34) +
'} '+
'] '.
IdHTTP1. Request. ContentType:='application/x - WWW - form - urlencoded';
IdHTTP1. Request. CharSet:="utf-8";
IdHTTP1. Request. ContentEncoding:="utf-8";
IdHTTP1. GET (s, SS);
ShowMessage (SS. DataString);

CodePudding user response:

Chinese garbled?
If it is garbled, I'm change IDHTTP source code
IdCustomHTTPServer unit,
Procedure TIdHTTPRequestInfo. DecodeAndSetParams (const AValue: String).
.
//CharSet:=';
Utf-8 CharSet:=' ';//modify

Line 1788
  • Related