Lesson - 66 : Python Advanced - Python CGI Programming : Passing Information Using POST Method

Pubblicato il: 23 gennaio 2018
sul canale di: Sada Learning Hub
982
7

**************************************************
before watching this video please whatch this video to configure your setup    • Lesson - 62 : Python Advanced - Python CGI...  
Python Core PlayList :    • Lesson - 01 : Python3 - What is python  
Python Advanced PlayList :    • Lesson - 46 : Python Advanced - Python OOP...  
**************************************************

Python CGI Programming : Passing Information Using POST Method:
A generally more reliable method of passing information to a CGI program is the POST method. This packages the information in exactly the same way as GET methods, but instead of sending it as a text string after a ? in the URL it sends it as a separate message. This message comes into the CGI script in the form of the standard input.
Below is same hello_get.py script which handles GET as well as POST method.
Example :
#!/usr/bin/python
Import modules for CGI handling
import cgi, cgitb
Create instance of FieldStorage
form = cgi.FieldStorage()
Get data from fields
first_name = form.getvalue('first_name')
last_name = form.getvalue('last_name')
print "Content-type:text/html\r\n\r\n"
print "<html>"
print "<head>"
print "<title>Hello - Second CGI Program</title>"
print "</head>"
print "<body>"
print "<h2>Hello %s %s</h2>" % (first_name, last_name)
print "</body>"
print "</html>”

<form action="/cgi-bin/hello_get.py" method="post">
First Name: <input type="text" name="first_name"><br /> Last Name: <input type="text" name="last_name" /> <input type="submit" value="Submit" />
</form>

Sample Projects : https://github.com/SadaLearningHub1/P...


In questa pagina del sito puoi guardare il video online Lesson - 66 : Python Advanced - Python CGI Programming : Passing Information Using POST Method della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Sada Learning Hub 23 gennaio 2018, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 982 volte e gli è piaciuto 7 spettatori. Buona visione!