You are not logged in.
Pages: 1
hell everyone , In my demo I used the indy, now I want replace TIdHTTPRequestInfo to the mORMot .
how to it ? thanks!
code like this :
function CheckSignature(ARequestInfo: TIdHTTPRequestInfo): boolean;
var
signature, timestamp, nonce, echostr: String;
tmpstr: TStringList;
temp: String;
begin
tmpstr := TStringList.Create;
try
signature := ARequestInfo.Params.Values['signature'];
timestamp := ARequestInfo.Params.Values['timestamp'];
nonce := ARequestInfo.Params.Values['nonce'];
echostr := ARequestInfo.Params.Values['echostr'];
tmpstr.Add(Token);
tmpstr.Add(timestamp);
tmpstr.Add(nonce);
tmpstr.Sort;
temp := StringReplace(tmpstr.text, #13#10, '', [rfReplaceAll]);
Result := SHA1(temp) = signature;
finally
tmpstr.Free;
end;
end;
delphi berlin update 2, win 10
thanks!
Offline
Can you be more specific about what you need?
If you want want to connect your Delphi client to mORMot server use specific mORMot classes like shown in sample 4.
If you want to retrieve some resource (page) from net, use HttpGet or appropriate classes from SynCrtSock.
If you want to send some data then use HttpPost.
Offline
thanks igors233!
I Visited http://127.0.0.1/wxapi?wid=1 and then I want get the values Wid=1 ,and other Return values like this: signature := ARequestInfo.Params.Values['signature'];
timestamp := ARequestInfo.Params.Values['timestamp']; nonce := ARequestInfo.Params.Values['nonce'];
Offline
You're writing a client right (not the server)?
Do you want to parse retrieved content from some site? AFAIK if returned values are in ini style formt (key=value with each pair in new line) then you would have to do that manually, load it into some TStringList and then access it similar as you did in Indy.
Offline
igors233,Thank you for your reply!
Sorry, I may not have a clear description, the establishment of a mormot service, and then send a get request to fill in the external URL, and with four parameters: Signature, Timestamp, Nonce, Echostr; according to the value of these parameters, the need to check the mormot service request is not legitimate.
If checksum is returned by true.
Offline
Sorry I still don't follow what you really need, try to answer these questions:
1) Are you writing mORMot Client (communicating with some external web site) or Server (respoding to client requests)?
2) Do you need to send some data or receive some data (or both)?
Offline
igors233, Thank you very much for your reply!
The url:http://127.0.0.1/wxapi? Wid=1 access Web services, then the server receives the request, access to such data: /wxapi=1? &signature=aaaaa&echostr=bbbbb×tmp=cccc, now I want to break out of the data, such as: wxapi=1; signnature = aaaaa; timestmp=cccc;
how to deal with mormot?
Offline
Sorry but I'm still not sure what you want to do, are you writing a server side code that should handle requests such as:
http://127.0.0.1/wxapi=1?&signature=aaa … estmp=cccc?
If so then you can define method service and parse input params with ease using features available in TSQLRestServerURIContext, take a look at docs, it's explained well: https://synopse.info/files/html/Synopse … ml#TITL_49
Offline
Pages: 1