4

Is it possible to exchange data between a PHP page and a Python application? How can I implement a PHP page that reacts to a Python application?

EDIT:

My application is divided in 2 parts: the web backend and a Python daemon. Via the web backend I upload MP3s to my server; these MP3s are processed by my Python daemon which fetch metadata from Musicbrainz.

Now:

I need to ask the user the results of the "Python fetch" to choose the right metadata. Is this possible?

4
  • Yes, it is possible. What exactly are you trying to do? Commented Mar 20, 2014 at 18:58
  • I have a Python application which checks for some MP3 metadata on online databases and I need to output its result in response to the PHP page that uploads songs on my server. Commented Mar 20, 2014 at 19:00
  • you need python call internal php code Or call as web page and pass params? Commented Mar 20, 2014 at 19:05
  • I edited the description. Now it should be clearer. Commented Mar 20, 2014 at 20:10

1 Answer 1

1

Write a Python script that takes a path in sys.argv or the audio data via sys.stdin and writes metadata to sys.stdout. Call it from PHP using exec.

Sign up to request clarification or add additional context in comments.

1 Comment

It's how Unix has been working for 30 years. But now that you mentioned a daemon you'll want to connect via a socket instead of a pipe.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.