You are not logged in.
Pages: 1
Hi ab,
I would like use mormot to callback another web site for his web API? how to use?
Thank you
like this:
aURL : [url]https://api.weixin.qq.com/cgi-bin/get_current_selfmenu_info?access_token=%s[/url]
function HTTP_Request(aURL, UTF8:string; RequestMode: string): AnsiString;
var
MyHttp : TNetHTTPClient;
aUTF8: TStringStream;
begin
Result := '';
MyHttp := TNetHTTPClient.Create(nil);
aUTF8 := TStringStream.create;
try
with MyHttp do
begin
aUTF8.Clear;
ConnectionTimeout := 2000;
ResponseTimeout := 10000;
AcceptCharSet := UTF8;
AcceptEncoding := '65001';
AcceptLanguage := 'zh-CN';
ContentType := 'text/Html';
try
if LowerCase(RequestMode) = 'get' then
Get(aURL,aUTF8)
else
if LowerCase(RequestMode) = 'set' then
exit;// Post(aURL);
Result := aUTF8.DataString;
except
on E: Exception do
showmessage(e.Message);
end;
end;
finally
FreeAndNil(MyHttp);
FreeAndNil(aUTF8);
end;
end;
Offline
I just use HttpGet()
Offline
Thanks ,ab
my code complier on delphi 10.1 and win 10 64
Offline
Thank esmondb and thank ab again! I Got it ,used ok!
Offline
Pages: 1