在Python中为PHP Web应用程序公开API?

I want to create a stock picking game just to challenge my friend to see who does best with say, a million dollars. I am planning on using a Python module to fetch the stock data from Yahoo finance API. I then want my friend to login and buy/sell stock with the virtual dollars he has from the web app (PHP).

So, how do I interface the Python module to that of the web app? I am hoping I made some sense!

Tonnes of ways:

  • HTTP (look into Tornado Web or similar)
  • Sockets
  • A database (such as MySQL)
  • Hell, even a textfile

That's assuming of course that you actually want the Python running continuously. A cron job might work fine too: http://en.wikipedia.org/wiki/Cron