Passing Data to a Python Web Crawler from PHP Script
Best possible way to remove dependencies of working with different languages is to use a message queuing library (like rabbitMQ or ActiveMQ)
By using this you can send direct messages from php to python or vice versa...
If you want an easy way out you need to modify your python script(more on the lines of what fabrik said) to poll a database(or a file) for any new jobs...and process it if it finds one...
I've got a python crawler crawling a few webpages every few minutes. I'm now trying to implement a user interface to be accessed over the web and to display the data obtained by the crawler. I'm going to use php/html for the interface. Anyway, the user interface needs some sort of button which triggers the crawler to crawl a specific website straight away (and not wait for the next crawl iteration).
Now, is there a way of sending data from the php script to the running python script? I was thinking about standard input/output, but could not find a way this can be done (writing from one process to another process stdin). Then I was thinking about using a shared file which php writes into and python reads from. But then I would need some way to let the python script know, that new data has been written to the file and a way to let the php script know when the crawler has finished its task. Another way would be sockets - but then I think, this would be a bit over the top and not as simple as possible.
Do you have any suggestions to keep everything as simple as possible but still allowing me to send data from a php script to a running python process?
Thanks in advance for any ideas!
Edit: I should note, that the crawler saves the obtained data into a sql database, which php can access. So passing data from the python crawler to the php script is no problem. It's the other way round.