Delphi - Indy TIdHttp.Get具有较大的URL长度

use*_*996 2 delphi string http indy idhttp

我正在尝试使用Indy 10中的GET方法,但我的URL长度大于255个字符.并且GET方法只接受"字符串"参数.

body := httpCom.Get('..........wide string.........')
Run Code Online (Sandbox Code Playgroud)

Delphi的编译器给我错误:

"字符串文字最多可包含255个元素"

是否有任何解决方案或不同的第三方组件来解决这个问题?

bum*_*mmi 6

没有字符串类型的问题,但IDE,你可以像这样写它

Const
   C_URL = 'A long text with 255 Characters ....to be contionued ...'
          +'more content....to be contionued ... '
          +'more more content....to be contionued ... '
          +'enough content';
begin
  IDHTTP1.Get(C_URL);
end;
Run Code Online (Sandbox Code Playgroud)

要么

  IDHTTP1.Get( 'A long text with 255 Characters ....to be contionued ...'
          +'more content....to be contionued ... '
          +'more more content....to be contionued ... '
          +'enough content');
Run Code Online (Sandbox Code Playgroud)

  • 我的天啊!它奏效了!Thaaaaanks太多了! (2认同)