Example of a Web application.

    HTML
    <HTML>
    <HEAD>
    <META HTTP-EQUIV=Content-Language CONTENT=ja>
    <META HTTP-EQUIV=Content-Type CONTENT='text/html; charset=UTF-8'>
    </HEAD>
    <BODY BGCOLOR=#DDDDDD>
    
    <FORM METHOD="POST" ACTION="/cgi-bin/webapi.cgi">
    
    Database 
             <input type="text" name="pgdatabase" length=32>
    Username 
             <input type="text" name="pguser2" length=32>
    Password 
             <input type="text" name="pgpassword2" length=32>
    
    <INPUT TYPE=SUBMIT VALUE="submit">
    </FORM>
    
    </BODY>
    </HTML>
    

    Web application (CGI) -- "webapi.cgi"
    #!/usr/local/bin/pgbash
    ##########################################################################
    #  "webapi.cgi"
    #
    #   $pgdatabase   # database name
    #   $pguser2      # database user
    #   $pgpassword2  # database password
    #  
    ##########################################################################
    exec 2>&1
    echo "Content-type:  text/html"
    echo ""
    set EXEC_SQL_OPTION CGI;
    
    #--------- start HTML ----------
    echo "<HTML>"
    echo "<HEAD>"
    echo "<META HTTP-EQUIV=Content-Language CONTENT=ja>"
    echo "<META HTTP-EQUIV=Content-Type CONTENT='text/html; charset=UTF-8'>"
    echo "</HEAD>"
    echo "<BODY BGCOLOR=#DDDDDD>"
    
    #-------- connect to DATABASE ---------
    connect to $pgdatabase user $pguser2  $pgpassword2;
    
    if(( SQLCODE != 0 )); then
       exit
    fi
    
    #---------- client_encoding -----------
    set client_encoding='UTF8';
    
    #------------ execute SQL -------------
    select * from member;
    
    if (( SQLCODE == 0 && SQLNTUPLE == 0 )); then
    echo "<H2>Data not found.</H2>"
    fi
    
    #------- disconnect DATABASE ----------
    disconnect all;
    
    echo "</BODY>"
    echo "</HTML>"
    

    Output
    useridnameemailtelkind ....
    1220XXXXXXXmmmmmmmm@nifty.ne.jp0726-76-9999*  
    1249XXXXXXmmmmmmm@email.ne.jp090-7103-9999*  
    1217XXXXmmmmmmmm@nifty.ne.jp042-571-9999NET  
    1221XXXXmmmmm@mbg.sphere.ne.jp0726-27-9999*  
    1250XXXXmmmmmmm@oct.zaq.ne.jp06-6622-9999*  
    1271XXXXXmmmmmmmm@nifty.ne.jp06-6872-9999*  
    1222XXXXmmmmmmmm@nifty.ne.jp0798-72-9999*  
    1212XXXXmmmmmm@sannet.ne.jp0725-20-9999*  
    1203XXXXmmmm@computer.com0742-40-9999*  
    1223XXXXmmmmmmmm@nifty.ne.jp0742-45-9999*