POST - GET

mod_harbour is an Apache module that allows to run PRGs directly on the web !!!

POST - GET

Postby Otto » Wed Sep 01, 2021 10:27 am

Adhemar, I extended the sample to show POST and GET methods.

program1.prg

Code: Select all  Expand view


function main
    local cTest := "my Test"
    local cTest2 := "my Test lorem ipsum"


    ? "<HR>"
    ? "AP_Body()"
    ? AP_Body()
    ? "<HR>"

    ? "AP_Method()"
    ? AP_Method()
    ? "<HR>"

    ? "AP_UserIP() --> cUserIP  returns the IP, as string, of the client"
    ? AP_UserIP()

    ? "<HR>"
    ? "AP_HeadersIn() //--> Hash    returns a hash with all headers pairs, key and value"
    ? AP_HeadersIn()

    ? "<HR>"
    ? "AP_FileName() --> cFileName  returns the filename.prg provided to Apache by the client"
    ? ValToChar(AP_FileName())
    ? "<HR>"

    ? "AP_GetPairs() --> Hash   returns a hash with all GET pairs, key and value "
    ? ValToChar(AP_GetPairs())
    ? "<HR>"
    ? "AP_Args() --> cArgs  returns the args provided to Apache by the client if any "
    ? ValToChar( AP_Args() )
    ? "<HR>"
    ? "AP_PostPairs() --> Hash  returns a hash with all POST pairs, key and value"
    ? ( AP_PostPairs() )

    ? "<HR>"
    //AP_RPuts( uValue )    Sends a value, converted into a string, to the client. Returns nil
    AP_RPuts( "<H1>AP_RPUts test</H1><br>" )
    ? "<HR>"




TEMPLATE PARAMS cTest, cTest2

<!DOCTYPE html>
<html>
<head>
    <head>
        <meta charset="utf-8">
        <title>Meine Testseite</title>
    </head>
   
</head>
<body>
   
    <h1>Test  POST and GET</h1>
    <p>This is a test for POST and GET method</p>
   
    <h3>GET  method test</h3>
    <a href="program1.prg?test=<?prg return cTest ?>">Pasa variable - <?prg return cTest ?></a>
    <br>
    <a href="program1.prg?test=<?prg return cTest2 ?>">Pasa variable - <?prg return cTest2 ?></a>
    <br>

    <h3>POST method test - FORM</h3>
    <form action="program1.prg" method="post">
        User name:
        <br>
        <input type="text" name="username">
        <br>
        Password:
        <br>
        <input type="password" name="passw">
        <br><br>
        <input type="submit" value="Send data">
    </form>
</body>
</html>

ENDTEXT

return

//----------------------------------------------------------------------------//

 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6272
Joined: Fri Oct 07, 2005 7:07 pm

Return to mod_harbour

Who is online

Users browsing this forum: No registered users and 3 guests