2023年7月31日发(作者:)

创蓝云智短信接⼝发送短信函数创蓝云智短信接⼝发送短信函数

82936373839464748495051525354function CLSms(AMobile, AMsg: string): Integer; //创蓝短信var params:TStringList; Tmphttp:TIdHttp; sResult:string; SplitAry: TSplitArray; s:string; LHandler: TIdSSLIOHandlerSocketOpenSSL; stream, restream: TStringStream; jsonStr: string;begin result := -1;// params := (); Tmphttp:=(nil); try LHandler := (nil); try :=sslvSSLv23; ent:='Mozilla/5.0 (Windows NT 5.1; rv:46.0) '; Redirects := True; meout := 5000; tType := 'application/json'; t := 'utf-8'; ler := LHandler;// ('account='+FUserName);// ('password='+FPassword);// ('phone='+AMobile);// ('msg='+AnsiToUTF8(AMsg));// ('report=true'); jsonStr := '{"account":"' + FUserName + '","password":"' + FPassword + '","phone":"' + AMobile + '","msg":"' + AnsiToUTF8(AMsg) + '","report":"true"}'; stream := (jsonStr); restream := (''); (SmsUrl,stream,restream); sResult :=utf8toansi(ring);

// SplitString(sResult,#$A,SplitAry); if Pos('"code":"0"',sResult) > 0 then begin// s := Trim(SplitAry[0]);// Result := strtoInt(Copy(s,Pos(',',s)+1,Length(s))); Result := strtoInt(BetweenString(sResult,'"code":"','",'));// SetLength(SplitAry, 0); end; finally ; ; ; end; finally FreeAndNil(Tmphttp);// (); end;end;

2023年7月31日发(作者:)

创蓝云智短信接⼝发送短信函数创蓝云智短信接⼝发送短信函数

82936373839464748495051525354function CLSms(AMobile, AMsg: string): Integer; //创蓝短信var params:TStringList; Tmphttp:TIdHttp; sResult:string; SplitAry: TSplitArray; s:string; LHandler: TIdSSLIOHandlerSocketOpenSSL; stream, restream: TStringStream; jsonStr: string;begin result := -1;// params := (); Tmphttp:=(nil); try LHandler := (nil); try :=sslvSSLv23; ent:='Mozilla/5.0 (Windows NT 5.1; rv:46.0) '; Redirects := True; meout := 5000; tType := 'application/json'; t := 'utf-8'; ler := LHandler;// ('account='+FUserName);// ('password='+FPassword);// ('phone='+AMobile);// ('msg='+AnsiToUTF8(AMsg));// ('report=true'); jsonStr := '{"account":"' + FUserName + '","password":"' + FPassword + '","phone":"' + AMobile + '","msg":"' + AnsiToUTF8(AMsg) + '","report":"true"}'; stream := (jsonStr); restream := (''); (SmsUrl,stream,restream); sResult :=utf8toansi(ring);

// SplitString(sResult,#$A,SplitAry); if Pos('"code":"0"',sResult) > 0 then begin// s := Trim(SplitAry[0]);// Result := strtoInt(Copy(s,Pos(',',s)+1,Length(s))); Result := strtoInt(BetweenString(sResult,'"code":"','",'));// SetLength(SplitAry, 0); end; finally ; ; ; end; finally FreeAndNil(Tmphttp);// (); end;end;