The UrlFetcher LotusScript Library (Tuesday, May 22)

Last week we talked about getting URLs in LotusScript, and Jan-Piet Mens asked about a more cross-platform approach (actually, he also made the same request on his own blog a few months ago). So, I recycled some old code and wrote some new, and J-P helped me test and debug it. As a result, here is a database with some Java and LS2J code that allows you to easily make cross-platform GET and POST requests from Java or LotusScript:

The UrlFetcher Java library is pretty well commented, and should answer most of your questions about how everything works. The UrlFetcherLS library in LotusScript is just an LS2J wrapper around the Java stuff, and it’s not nearly as well documented, but just read the comments in the Java class and you’ll figure it out.

There are also a few sample agents that show how some of the functionality works. For example:

Option Public
Option Declare
Use "UrlFetcherLS"

Sub Initialize
	Dim fetcher As New UrlFetcher
	Print fetcher.getUrlAsString("http://www.nsftools.com")
End Sub

That’s not too bad, is it? You can also get HTTP headers, set headers, add POST parameters, make proxy settings, and a few other things. I even have an example of making an SSL/HTTPS request, but that’s Notes 7 only. Everything else should work in both Notes 6 and 7.


[ permalink ] [ e-mail me ] [ read/add comments ]

Speak Your Mind