diff --git a/Projects/Simba/psextension.pas b/Projects/Simba/psextension.pas index b8c7d84..f01a9d5 100644 --- a/Projects/Simba/psextension.pas +++ b/Projects/Simba/psextension.pas @@ -66,6 +66,7 @@ uses tpa, //Tpa stuff SynRegExpr, lclintf, + httpsend, SimbaUnit,updateform, mmisc, mmlpsthread; // for GetTickCount and others.//Writeln {$ifdef Linux} @@ -183,6 +184,7 @@ begin AddFunction(@ext_InputQuery,'function InputQuery(const ACaption, APrompt : String; var Value : String) : Boolean;'); AddFunction(@ext_ScriptText,'function ScriptText: string;'); AddRegisteredPTRVariable('Settings','TMMLSettingsSandbox'); + AddFunction(@ext_GetPageEx,'function GetPageEx(const URL, PostData, MimeType: string): string;'); AddRegisteredVariable('Simba','TForm'); AddRegisteredVariable('Simba_MainMenu','TMainMenu'); AddRegisteredVariable('Client','TClient'); diff --git a/Units/MMLAddon/PSInc/Wrappers/extensions.inc b/Units/MMLAddon/PSInc/Wrappers/extensions.inc index 3430cb2..f4eeb01 100644 --- a/Units/MMLAddon/PSInc/Wrappers/extensions.inc +++ b/Units/MMLAddon/PSInc/Wrappers/extensions.inc @@ -128,3 +128,28 @@ begin Result := SimbaForm.CurrScript.SynEdit.Lines.Text; Result := ReplaceRegExpr('Players\[(.*?)\]\.([N|n][A|a][M|m][E|e]|[P|p][A|a][S|s]{2}|[P|p][I|i][N|n])\s*\:\=\s*\''.*?\'';', Result, 'Players[$1].$2 := ''*********'';', True); end; + +function ext_GetPageEx(const URL, PostData, MimeType: string): string; +var + HTTPSend: THTTPSend; +begin + HTTPSend := THTTPSend.Create; + try + HTTPSend.MimeType := MimeType; + HTTPSend.Document.Clear; + HTTPSend.Document.Write(PostData[1], Length(PostData)); + try + if HTTPSend.HTTPMethod('POST', URL) then + begin; + SetLength(Result, HTTPSend.Document.Size); + HTTPSend.Document.Read(Result[1], Length(Result)); + end else + Result := ''; + except + on e : exception do + mDebugLn('Exception in GetPage in Extensions: ' + e.message); + end; + finally + HTTPSend.Free; + end; +end;