Converting server-based cgi app to work locally

Sarah Reichelt sarah.reichelt at gmail.com
Tue May 19 17:20:48 EDT 2009


On Wed, May 20, 2009 at 12:40 AM, Richard Miller <wow at together.net> wrote:
> I have a Rev app that is closely integrated with some remote server-based
> Rev cgi scripting. I'd like to modify the app so it can work locally when
> there's no internet connection.
>
> I have lots of calls like this:
>
> put url ("http://65.23.xxx.x/cgi-bin/RevSearch.cgi?setcompdata=" & compfile
> & "=" & urlencode(compdata)) into x
>
> What's the simplest way to modify this to work locally? I have no experience
> doing this. I'm thinking I can put a Rev cgi engine somewhere on my PC and
> then simply change the URL so it points locally. Does that engine need to go
> into a specific folder or can it go anywhere? How then do I structure the
> URL?

I guess this depends on how your app is going to get it's data if
there is no connection.

I have a similar app and when testing, I turn on the web server in my
own computer, install my cgi-scripts there and use "localhost" instead
of the IP address. That is on the Mac, I don't know anything about web
serving under Windows.

Another option would be to run a version of Andre's RevOnRockets HTTP
stack as your server and somehow get it to supply the required data.

If this is going to work, I presume you have a set of default data
that you can supply instead of whatever was supposed to be coming from
the web server. So a better way might be to check for an internet
connection and then have functions that get your data. e.g.

if connectedToNet then
   put url ("http://65.23.xxx.x/cgi-bin/RevSearch.cgi?setcompdata=" &
compfile & "=" & urlencode(compdata)) into x
else
   put "default data" into x
end if

One of the simplest ways to check for an internet connection is to put
a text file on your site containing nothing but the number 1.
Then:
  put "http://mysite.com/test.txt" into tCheck
  if tCheck = 1 then ... you are connected
The virtue of this is that it tests the connection to the relevant server too.

HTH,
Sarah



More information about the use-livecode mailing list