PDA

View Full Version : using python in combination with php


UnrealEd
09-18-06, 06:40 AM
hi,

i've recently developped a php class that searches on your server for files containing a specific keyword. This search engine also includes reading mp3 files for artist, album genre and year. As this is very intensive i was thinking of writing the dir-scan part in python.

Is this possible? i know to execute external programs with php (exec, shell_exec), but they usually require additional params. here's an example:
$username = "UnrealEd";
$password = "thisisstatedinthisdatabase"
shell_exec("myprog $username $password");
is there any way to do something like this with python. something like this:
$searchString = $_POST['sString'];
shell_exec("advancedSearch.py $searchString");

thans in adnvace,
UnrealEd

UnrealEd
09-29-06, 05:34 AM
sorry for double posting.

I found it. i have to use the getopt module in combination with the sys module:

import sys
import getopt

opts, args = getopt.getopt(sys.argv[1:], "ho:v", ["help", "output="])

more info can be found in the python docs about the getopt (http://docs.python.org/lib/module-getopt.html) module

Greetz,
UnrealEd