Sending iTunes track infos to a PHP script with AppleScript

Hi, and welcome to me! :smiley:

I’m a French webdevelopper, I’m new in AppleScript and I’m looking for a way to send iTunes track infos to a PHP script on my webserver to display what I am listening to on my homepage.

It’s OK to get all the track info I want, also I extract the artwork but what is the way to post all this data to my PHP like it was in a web form?

Also, I’m looking for what is the event in iTunes to execute my script each time a track is finished to play?

Thanks a lot! :cool:


Finally, I almost finished my script but I have somme problem with the CURL command in AppleScript, I tried many possibilities but it fails.

It returns :
sh: -c: line 1: unexpected EOF while looking for matching `‘’
sh: -c: line 2: syntax error: unexpected end of file

Thanks for your help! :slight_smile:

Combo, I see what you meant about posting the code. I’m afraid I lost the URL you had there; Feel free to put it back.

Edit: I found the URL, sorry about that.

Have you looked at the “-F” option? In your first post you mentioned emulating a post from a form.

No I did not. But I don’t think it will change something because the error is coming from the concatenation of my string variables.

I use do shell script “curl -d” with success to post text info from my iTunes tracks to my PHP script like it was in a form and I’m looking for the way to upload the artwork. FTP-like CURL -T is a good option in my opinion and it works in do shell script like this :

set the_file to "/Users/Naico/Desktop/Temporaire/mdn/red_hot_chili_peppers-californication.jpg"
set curl_ftp to "ftp://login:pass@host/dir/"

do shell script "curl -T " & the_file & " " & curl_ftp

So I really don’t understand why it does not work when I try to add the file name after the path… :frowning: