| | |
Reciving 3rd party info
![]() |
•
•
Join Date: Nov 2008
Posts: 58
Reputation:
Solved Threads: 0
I have a third party sending me some infomaion. They say to use php $_post to recieve the information as follows
now i want to do this with python and have come up with
But nothing is being update. Is there another way to get the POST data?
Python Syntax (Toggle Plain Text)
<?php //include the database handling class include("mysqlclass.php"); //Assign POSTED variables $destination = $_POST['gwNumber']; $originator = $_POST['originator']; $message = $_POST['message']; $smsTime = $_POST['smsTime']; $timeZone = $_POST['timeZone']; $network = $_POST['network']; $id = $_POST['id']; $status = $_POST['status']; //Create a new instance of the mysql class and write data to database $mysql = New mysql(0); $sql = " INSERT INTO virtual (varOriginator, varDestination, varMessage, varTime, intTimeZone, varNetwork, intId) VALUES ('$originator', '$destination', '$message', '$smstime', '$timeZone', '$network', '$id')"; $mysql->query($sql); ?>
now i want to do this with python and have come up with
Python Syntax (Toggle Plain Text)
#!/usr/bin/python import MySQLdb import cgi print "Content-type: text/html\n" # connect db = MySQLdb.connect(host = "localhost", user = "dfgdfgdfgdgfdfgdfgdfg passwd = "Udfgfdgdfgdfgdfdfgfdggsgsf", db = "adamplo1_UniProject") # create a database cursor cursor = db.cursor(MySQLdb.cursors.DictCursor) #execute SQL select statement form = cgi.FieldStorage() destination = "sdfsdfsdf" originator = "sdfsdfsdf" message = form["message"] smsTime = "sdfsdfsdf" timeZone = "11" network = "sdfsdfsdf" ID = "1" status = "sdfsdfsdf" sql = "INSERT INTO virtual (varOriginator, varDestination, varMessage, varTime, intTimeZone, varNetwork, intId) VALUES ('"+originator+"', '"+destination+"', '"+message+"', '"+smsTime+"', '"+timeZone+"', '"+network+"', '"+ID+"')" print sql print cursor.execute(sql)
But nothing is being update. Is there another way to get the POST data?
Last edited by adam291086; Jan 28th, 2009 at 7:04 am.
![]() |
Other Threads in the Python Forum
- Previous Thread: Fixed width to csv conversion
- Next Thread: Error: object has no attribute 'xxx'
| Thread Tools | Search this Thread |
alarm ansi assignment avogadro backend beginner binary bluetooth character cmd code customdialog cx-freeze data decimals dictionary directory dynamic error examples exe file float format function generator gnu graphics gui halp heads homework http ideas import input itunes java leftmouse line linux list lists loop maze module mouse number numbers output parsing path pointer port prime programming progressbar projects push py2exe pygame pyglet pyqt python random recursion schedule screensaverloopinactive script scrolledtext slicenotation sqlite ssh statistics string strings sudokusolver sum terminal text thread threading time tlapse tricks tuple tutorial ubuntu unicode urllib urllib2 variable ventrilo vigenere web webservice wikipedia write wxpython xlib





