Search the Community
Showing results for tags 'IdHTTPServer1CommandGet'.
-
Hi, i try to use paypals IPN (Instant Payment Notification) I have a paypal express checkout button on my form and after a successfully payment paypal send me a confirmation. Its works ok i also get success from paypal side (IPN was sent and the handshake was verified.) The problem is that i can't get the request text that paypal send to me. I will use the request text on a memo in my session. Have somebody any idea how to make this? i use TIdHTTPServer, TIdHTTPand TIdSSLIOHandlerSocketOpenSSL places on the UniServerModule form with following settings object IdHTTPServer1: TIdHTTPServer Active = True Bindings = <> DefaultPort = 82 AutoStartSession = True OnCommandGet = IdHTTPServer1CommandGet Left = 60 Top = 80 end object http1: TIdHTTP IOHandler = OpenSSL AllowCookies = True ProxyParams.BasicAuthentication = False ProxyParams.ProxyPort = 0 Request.ContentLength = -1 Request.Accept = 'text/html, */*' Request.BasicAuthentication = False Request.UserAgent = 'Mozilla/3.0 (compatible; Indy Library)' HTTPOptions = [] Left = 175 Top = 80 end object OpenSSL: TIdSSLIOHandlerSocketOpenSSL MaxLineAction = maException Port = 0 DefaultPort = 0 SSLOptions.Method = sslvSSLv23 SSLOptions.Mode = sslmClient SSLOptions.VerifyMode = [] SSLOptions.VerifyDepth = 0 Left = 215 Top = 140 end and the code i use is procedure TUniServerModule.IdHTTPServer1CommandGet(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo); var strWrite : TStringList; strRead : String; begin strWrite := TStringList.Create; try strWrite.Add(ARequestInfo.FormParams+'&cmd=_notify-validate'); IdHTTP1.Request.UserAgent := 'application/x-www-form-urlencoded'; IdHTTP1.ReadTimeout := 0; IdHTTP1.IOHandler := OpenSSL; strRead := IdHTTP1.Post('https://www.paypal.com/cgi-bin/webscr', strWrite); // If you are in live //strRead := IdHTTP1.Post('https://www.sandbox.paypal.com/cgi-bin/webscr', strWrite); // If you are in sandbox TThread.Synchronize(nil, procedure begin MainForm.UniMemo1.Lines.LoadFromStream(ARequestInfo.PostStream); //not works :-) //or MainForm.UniMemo2.text := strRead; MainForm.UniMemo2.Lines.SaveToFile(Uniservermodule.FilesFolderPath + 'test.txt'); //not works :-) end); except on E: Exception do begin showmessage('Error encountered during POST: ' + E.Message); end; end; strWrite.Free; end; Any Suggestion on how to print out the ARequestInfo informations??? Thanks