[Dxspider-support] CGI

Ruben Navarro Huedo eb5esx at eb5esx.ampr.org
Tue May 23 15:16:38 BST 2006


A lot of thank's.
I go to study it.


El 23/05/2006, a las 0:17, Bela Markus escribió:

> Hi All,
>
> just for demonstration I attached a simple CGI program written in  
> PYTHON. This will execute an "SH/DX" command with a predefined  
> argument and print the result on the WEB page.
>
> Program lacks user input parameters and formatting but do the job.
>
> Regards... Béla, HA5DI
>
> P.S.: BTW, if you are looking for a language which easy to learn,  
> has a nice clear syntax not like the nasty PERL (sorry Dirk),  
> available free on both LINUX and WINDOWS, I kindly advice to learn  
> PYTHON. You will love it.
>
> Regards... Béla, HA5DI
>
>
> Dirk Koopman írta:
>> On Tue, 2006-05-16 at 19:54 +0200, Ruben Navarro Huedo wrote:
>>
>>> Hello friends:
>>> We are trying to setup a CGI to extract last 25 DX from our Spider.
>>> We have done it with expect. Something like this:
>>>
>>
>>
>>> #!/usr/bin/expect
>>>
>>> puts "Content-type: text/plain\n"
>>>
>>> log_user 0
>>> spawn telnet localhost 8000
>>>
>>
>> <snip>
>>
>> Could I suggest that, instead of using expect, you all have a look
>> at /spider/perl/showdx. It is not a CGI program, but could easily be
>> modified (by someone else, preferably) to do what you require using
>> CPI.pm.
>>
>> This has the advantage that it looks at the files and does not  
>> connect
>> to the node at all.
>>
>> Dirk
>>
>>
>>
>> _______________________________________________
>> Dxspider-support mailing list
>> Dxspider-support at dxcluster.org
>> http://mailman.tobit.co.uk/mailman/listinfo/dxspider-support
>>
>>
>
> #!/usr/bin/python
>
> ##########################################################
> # CGI demonstration written in PYTHON for SPIDER         #
> #                                                        #
> # Generates HTML output of SH/DX command with parameters #
> # defined in the cmdarg variable.                        #
> #                                                        #
> # Prerequisits:                                          #
> #                                                        #
> # - APACHE WEB server installed                          #
> #                                                        #
> # - PYTHON interpreter, usually installed by default     #
> #   on LINUX systems, you don't have to deal with         
> #                                   #
> #                                                        #
> # Installation:                                          #
> #                                                        #
> # - copy script to the CGI directory of your WEB server, #
> #   typically /var/www/cgi-bin on LINUX systems          #
> #                                                        #
> # - change default value of cmdarg variable if necessary #
> #                                                        #
> # Usage:                                                 #
> #                                                        #
> # http://yourwebserver/cgi-bin/shdx                      #
> #                                                        #
> # (C) Bela, HA5DI - ha5di at freemail.hu - 22.05.2006       #
> ##########################################################
>
> import os
>
> # Parameter of the SH/DX command. Do not leave string empty
>
> cmdarg = "10"
>
> # Execute command
>
> child_stdin, child_stdout = os.popen2("/spider/perl/showdx"+"  
> "+cmdarg)
> child_stdin.close()
> res = child_stdout.read()
> child_stdout.close()
>
> # Generate HTML output
>
> print "Content-type: text/html\n\n";
> print res.replace('\n', '<br>\n')
> _______________________________________________
> Dxspider-support mailing list
> Dxspider-support at dxcluster.org
> http://mailman.tobit.co.uk/mailman/listinfo/dxspider-support




More information about the Dxspider-support mailing list