Delphi 获取百度ai 获取token


本文整理自网络,侵删。

 var
 idhttp2:Tidhttp;
 authHost:string;
 tokSl:Tstringlist;
begin
  authHost:= 'http://aip.baidubce.com/oauth/2.0/token';
  try
    tokSl:=Tstringlist.Create;
    idhttp2:=Tidhttp.Create(nil);
    toksl.Add('grant_type=' + grant_type);
    toksl.Add('client_id=' + client_id);
    toksl.Add('client_secret=' + client_secret);
    Result:=idhttp2.Post(authHost,toksl);
  finally
    toksl.Free;
    idhttp2.DisposeOf;
  end;

end;

 

获取结果:

{

    "access_token": "1.a6b7dbd428f731035f771b8d********.86400.1292922000-2346678-124328",

    "expires_in": 2592000,

    "refresh_token": "2.385d55f8615fdfd9edb7c4b********.604800.1293440400-2346678-124328",

    "scope": "public audio_tts_post ...",

    "session_key": "ANXxSNjwQDugf8615Onqeik********CdlLxn",

    "session_secret": "248APxvxjCZ0VEC********aK4oZExMB",

}

相关阅读 >>

Delphi 基础学习 字符串去掉回车符

monthdays:给出一个月的天数

Delphi synedit1 synmemo1 显示行号

Delphi 逐个分解后字符串加载到stringgrid1

Delphi xe6 取得app自己的版本号(横跨4个平台)

Delphi 匹配中文的正则表达式

Delphi 调用dll运行正常,退出时弹出错误解决办法

Delphi format 另类用法

Delphi中使用 twebbrowser 编辑网页

Delphi里label显示多行文本的两种方法

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...