This method creates a temporary file called temp post request.html, puts parameters in it, and calls it using a web browser.
procedure OpenBrowserWithPostRequest;
var
HTMLFileName, HTMLContent: string;
HTMLFile: TextFile;
begin
// temp HTML file
HTMLFileName := ExtractFilePath( ParamStr(0)) + 'temp_post_request.html';
// HTML file write
HTMLContent :=
'<html>' +
'<body onload="document.forms[0].submit()">' +
'<form action="http://127.0.0.1/exam1" method="POST">' +
'<input type="hidden" name="param1" value="exam">' +
'<input type="hidden" name="param2" value="1">' +
'<input type="hidden" name="param3" value="3">' +
'</form>' +
'</body>' +
'</html>';
AssignFile( HTMLFile, HTMLFileName );
Rewrite( HTMLFile );
Write( HTMLFile, HTMLContent );
CloseFile( HTMLFile );
ShellExecute(0, 'open', PChar( HTMLFileName ), nil, nil, SW_SHOWNORMAL);
end;
댓글 없음:
댓글 쓰기