|
#1
| |||
| |||
| Php, Exec();, and iTunes. Im looking for a terminal command that will return the current song / artist playing on my computer's iTunes. I intend to use it with Php. |
|
#2
| ||||
| ||||
| tuaw.com has exactly what you're looking for. Rather than put the command in a an executable script as they demonstrate, you could just use the "osascript" command directly in an exec() call. See: http://www.tuaw.com/2007/04/02/termi...-command-line/ |
|
#3
| ||||
| ||||
| Or iTunes info to Terminal as Applescript http://dougscripts.com/itunes/script...page=1#iscroll This might be useful too http://www.bombaydigital.com/arenared/2003/10/11/1 |
|
#4
| |||
| |||
| Hm, it works in the terminal (Thanks!) but doesn't work in php.. Im doing - <?php exec("./nowplaying"); ?> and have tried <?php echo exec("./nowplaying"); ?> (Exec has worked for other commands.) Edit: Nvm, got it working. Had to put the nowplaying file in my sites folder. Thanks!Last edited by Moptop; July 26th, 2007 at 05:17 PM. |
|
#5
| |||
| |||
| Ok, Im back. It stopped working after I messed with httpd.conf. What could I of screwed up? Everything else in PHP still works... Other commands still work in exe() too... I had removed some virtual hosts stuff I had added in awhile ago, I even tried using the default httpd.conf, but no luck... Last edited by Moptop; July 27th, 2007 at 02:03 PM. |
|
#6
| ||||
| ||||
| Have you altered your php.ini file also? Try having PHP report everything (notices and warnings as well as errors) by setting error_reporting in your php.ini file: Code: error_reporting = E_ALL Note that you can also test PHP scripts with the "php" command. Say your script is "run.php", you could do: Code: php run.php |
|
#7
| |||
| |||
| No, I haven't altered my php.ini. I checked it now, error reporting is already at that. I tried that in the terminal, and got this... 39:44: syntax error: Expected “then”, etc. but found identifier. (-2741) But my php script doesn't have nearly 39 lines? Could it be referring to the other thingy (nowplaying) ? Edit: Never mind about that, I didn't open itunes. (the nowplaying script requires that.) So, its working fine in the terminal, but not apache? Does the terminal php use mac's default php? Because I have php5.2.2 from Here. |
|
#8
| ||||
| ||||
| Quote:
Code: /usr/local/php5/bin/php somescript.php |
![]() |
| Thread Tools | |
|
|