[thelist] CGI to Cold Fusion

.jeff jeff at members.evolt.org
Tue Jun 5 11:34:29 CDT 2001


josh,

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: Josh Spiegel
:
: > 1) is that really all the cgi file is doing?
:
: The cgi is really doing a whois on odd ball domain
: tlds (.vc, .ts, etc.).  it uses some specialty xml
: perl module and a bunch of other modules that make
: it very hard for me to recreate in cold fusion.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

obviously the best way is to use the cgi file then.

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: > 3) what version of cf server is this going
: >    to be running on?
:
: CF 4.5
:
: > 4) if necessary, can you install a cfx tag?
:
: Yes.  I have admin privileges.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

excellent.  you have a bunch more options available to you then.

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: > 5) is the cgi template and the coldfusion
: >    template on the same machine?  if not,
: >    are they on the same network?
:
: Yes. Same machine.  (I am running a fairly new
: release of active perl)
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sounds to me like you wanna take a look at the built-in cf tag -- cfexecute.
with it you can instantiate a process from the command-line.

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: > 6) is the value the cgi script is returning
: >    a simple value or a complex one?
:
: Simple (i.e. owner_fax, owner_address, etc.)
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

based on the way cfexecute works, i'd suggest putting alittle work into how
your cgi script works.  using cfexecute you can

a) call a cgi script and have its output directed straight to the bit
bucket:

<cfexecute
 name="ping.exe"
 arguments="yahoo.com"
></cfexecute>

b) call a cgi script and have its output directed to a file:

<cfexecute
 name="ping.exe"
 arguments="yahoo.com"
 outputfile="c:/outfile.txt"
></cfexecute>

c) call a cgi script and have its output in the calling page:

<cfexecute
 name="ping.exe"
 arguments="yahoo.com"
 timeout="100"
></cfexecute>

based on these options i'd say that option b or c would be your best, with c
being the most reliable.  to make it bulletproof, you're going to want to
wrap your cfexecute in a cftry/cfcatch sequence to trap any timeout errors
that occur.

<cftry>
  <cfexecute
   name="ping.exe"
   arguments="yahoo.com"
   timeout="100"
  ></cfexecute>
  <cfcatch type="Any">
  Oops, it took too long.
  </cfcatch>
</cftry>

if all you're looking to do is display the result of the whois, then rather
than create variables and values in your cgi output, i'd recommend that you
create a formatted output string, maybe even complete with html.

if you're looking to do more things with the output than simply display it
to the user then it's going to take alittle more complex solution than this.

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: although I could string them into an array
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

let's not get ahead of ourselves.  let's get one thing working at a time.

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: Side note: It seems like this should be easier.
: Isn't most of cold fusion derived from cgi?
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

well, sort of.  coldfusion is written in a language commonly used to write
cgi scripts -- c++.  interestingly enough, coldfusion used to be a cgi
script itself -- small enough in fact that the entire install fit on a 3.5"
floppy.

good luck,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/






More information about the thelist mailing list