September 1st, 2013, 04:40 PM
Python get data from external MYSQL
I have a website running with users and infromation about them.
PHP + MYSQL
I can not connect directly to the MYSQL from external locations. (Server in datacenter / python script on mobile device)
What I need to do is the following:
1. Get username and information from the database using the Python script.
2. Send data back to the MYSQL
The second part can be done by opening a page like:
Only before I can send the user id i have to get it in the python script. And at this part i'm getting lost.
September 1st, 2013, 10:41 PM
So, it sounds to me like what you really need to write here is a web service with which your Python script can communicate. Nowadays this is usually done by implementing a RESTful service on the web server side, and interchanging JSON formatted data using standard HTTP requests.
On the python side, you probably want to look into using the requests library to make your http requests to the server.