Saturday, May 06, 2006

Accessing the Web Using REALbasic

There are two essential things you need to know about in order to do things on the Web using REALbasic: a function called HTTPSocket and a control called HTLMViewer.

Here's the main difference between them. HTLMViewer allows you to View Web pages that have been written in HTML (or XHTML). You don't see the HTML (or XHTML) code itself: what you see is what you would see if you were to visit that page using a normal Web browser. HTTPSocket, on the other hand, actually Gets the HTML (or XHTML) file for you (or any other file whose URL you know on the remove Web server, such as a GIF or JPG file, an MP3 or MPG file, a PDF file, etc.).

So HTMLViewer lets you View a Web page, while HTTPSocket Gets the actual file ("Socket to Me!") for you (not just HTML or XHMTL, but any type of file you can access using HTTP).

I should start out with some simple examples for you, but I'll probably provide such later. The file for to day is NTGreek3.zip, which can be downloaded from http://traver.org/traverrb/.

Here's how the program works....

It's a NT (New Testament) Greek computer program that I wrote which allows you to look up a particular verse (or groups of verses in a chapter), to get the grammatical analysis for a particular word, and to see a literal word-for-word translation.

You do have to have Windows to run the program. A broadband connection to the Internet (cable or DSL) is also recommended. In addition (nd this won't mean much to you unless you're a student of New Testament Greek, the program has the limitation that the grammatical analysis is based on the Nestle Aland text, 26th edition, while the literal translation is based on the Textus Receptus. Even so, I think it's a useful program. (I'm at present tutoring an Indonesian pastor in Greek, so the program was written for his benefit.)

When you first run the program, your firewall program may ask you if you want to let the program access the Internet. Say, "Yes." (Important: You have to be connected to the Internet for the program to work.)

Select New Testament book, chapter, and verse(s). Then click on "Get Verse(s)." The program should get the appropriate verse(s) from the Greek New Testament for you. Click on a Greek word for a grammatical analysis (i.e., full parsing). Then click on "Get Verse(s)" to return to the Greek passage.

The code is not simple and I do not intend to explain the details at this point (especially since NTGreek3 is an "improved" version of NTGreek2 and NTGreek3 works better when I don't understand why it works at all, since I do not even return a value for the function HTTPSocket).

So the primary purpose of NTGreek3 for this blog is to show that you can do complicated things on the Internet (even if you don't really entirely know what you are doing?). In addition to viewing and getting files, you can extract useful information from Web pages and then create and display your own Web pages based on that extracted information.

As I said, I will try to provide some simpler examples of HTMLViewer and HTTPSocket in the future. But the NTGreek program (which, incidentally, has not been tested on a Mac, although it works fine in Windows) should illustrate that there is tremendous potential in the possibilities offered by HTMLViewer and HTTPSocket, if you want to write your own Web browser to do very particular things.)

Enjoy!

Barry Traver