| | |
Reciving 3rd party info
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
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 |
accessdenied apache application argv array beginner book builtin change color converter countpasswordentry curved dan08 dictionary dynamic edit enter examples file filename float format function gui homework import inches input java keyboard lapse library line lines linux list lists loop microphone mouse movingimageswithpygame mysql mysqlquery newb number numbers numeric output parameters parsing path phonebook plugin port prime programming projects py2exe pygame pyopengl pysimplewizard python random recursion redirect remote reverse scrolledtext session simple smtp software sprite statictext string strings syntax table tennis terminal text textarea thread threading time tkinter tlapse trick tuple tutorial ubuntu unicode unit urllib urllib2 variable windows wordgame wxpython





