These adverts are supporting the forum's costs and the products/services are not endorsed by the forum owners.
First have you tried?
Log in to Search the Forum for help!
Learn more about using FreeStyler at the FreeStyler WIKI HERE
Learn more about DMX in General at The DMX Wiki HERE

if all else fails and you need a fixture consider the fixture building service HERE

send command to FS from PHP

Discuss the latest developments or get support for them HERE.
Post Reply
samy_14
Knows how to turn Lights ON
Posts: 6
Joined: May 29th, 2011, 3:41 pm
FreeStyler Version: 3.3.2

send command to FS from PHP

Post by samy_14 »

Hi,

I'd like to develop a little interface in PHP to command PAR fixtures from a web server. After reading many topics in this forum I saw that I can use socket to send command directly to FS.

I try the command blackout and it works put not for the command channel 1 @ 255 :(

Code: Select all

$socket = @fsockopen($IP,$PORT,$codeErreur, $msgErreur);
fputs($socket,"FSOC002255"); // works correctly

fputs($socket,"FSOC320255");  // send "command 1"
fputs($socket,"FSOC332255");  // send "command @"
fputs($socket,"FSOC321255");  // send "command 2"
fputs($socket,"FSOC324255");  // send "command 5"
fputs($socket,"FSOC324255");  // send "command 5"
fputs($socket,"FSOC337255");  // send "command enter"

fsockclose($socket);
Can you tell me what is wrong in my code ?

Thanks in advance for you help.


User avatar
Mattotone
Android Dev (Moderator)
Posts: 1238
Joined: July 10th, 2007, 5:30 pm
FreeStyler Version: BETA
I Use FreeStyler for: Just for the Fun of it.

Re: send command to FS from PHP

Post by Mattotone »

Freestyler Addons www.120db.uk
Free Dropbox. 2GB account http://db.tt/J4c5G8C
$100 free credit @DigitalOcean Private Server: https://m.do.co/c/5c4a7c7d6693
Freestyler Android App: https://play.google.com/store/apps/deta ... rts.fs1024
samy_14
Knows how to turn Lights ON
Posts: 6
Joined: May 29th, 2011, 3:41 pm
FreeStyler Version: 3.3.2

Re: send command to FS from PHP

Post by samy_14 »

Thanks for you answer.

I read the topic you told me and try this :

Code: Select all

$socket = @fsockopen($IP,$PORT,$codeErreur, $msgErreur);
fputs($socket,"FSOC320255");  // send "command 1 click"
fputs($socket,"FSOC3200");  // send "command 1 release"
fputs($socket,"FSOC332255");  // send "command @ click"
fputs($socket,"FSOC3320");  // send "command @ release"
fputs($socket,"FSOC321255");  // send "command 2 click"
fputs($socket,"FSOC3210");  // send "command 2 release"
fputs($socket,"FSOC324255");  // send "command 5 click"
fputs($socket,"FSOC3240");  // send "command 5 release"
fputs($socket,"FSOC324255");  // send "command 5 click"
fputs($socket,"FSOC3240");  // send "command 5 release"
fputs($socket,"FSOC337255");  // send "command enter click"
fputs($socket,"FSOC337255");  // send "command enter release"
fclose($socket);
But it doesn't work.

Can anyone help me ?

thanks in advance
samy_14
Knows how to turn Lights ON
Posts: 6
Joined: May 29th, 2011, 3:41 pm
FreeStyler Version: 3.3.2

Re: send command to FS from PHP

Post by samy_14 »

Hi,

I create a little web interface to send command to FS with a little form.

fwrite($socket,"FSOC".$_PUT['CMD']."255"); //for only a click

Many command works correctly

After I modified my script to accept many commands in the same time
I test "008" ( open DMX 400) and "013" (open sound) with a break of 500ms between the 2 fwrite => work correctly, the 2 windows opened in FS

After I test to send command : 320,332,321,324,324,337 for "1@255Enter" => doesn't works.

Is there any way to see something in FS appear when I send only "command 1" for exemple? To see if FS understand it correctly.

Thanks in advance
samy_14
Knows how to turn Lights ON
Posts: 6
Joined: May 29th, 2011, 3:41 pm
FreeStyler Version: 3.3.2

Re: send command to FS from PHP

Post by samy_14 »

thanks.
I can send you packets contain of what my socket send to FS ?
User avatar
Mattotone
Android Dev (Moderator)
Posts: 1238
Joined: July 10th, 2007, 5:30 pm
FreeStyler Version: BETA
I Use FreeStyler for: Just for the Fun of it.

Re: send command to FS from PHP

Post by Mattotone »

Its a strange one, i can also send any command or even string of commands with no problem.
i can a whole group of parameters such as setting all 20 sequence speeds.

in tellnet the above code is printed as
FSOC320255FSOC3200FSOC332255FSOC3320FSOC320255FSOC320000FSOC319255FSOC319000FSOC3319255FSOC319000FSOC337255FSOC337255
Freestyler Addons www.120db.uk
Free Dropbox. 2GB account http://db.tt/J4c5G8C
$100 free credit @DigitalOcean Private Server: https://m.do.co/c/5c4a7c7d6693
Freestyler Android App: https://play.google.com/store/apps/deta ... rts.fs1024
User avatar
Mattotone
Android Dev (Moderator)
Posts: 1238
Joined: July 10th, 2007, 5:30 pm
FreeStyler Version: BETA
I Use FreeStyler for: Just for the Fun of it.

Re: send command to FS from PHP

Post by Mattotone »

id suggest send an email to raph with your complete php code for him to test and create a solution.
Freestyler Addons www.120db.uk
Free Dropbox. 2GB account http://db.tt/J4c5G8C
$100 free credit @DigitalOcean Private Server: https://m.do.co/c/5c4a7c7d6693
Freestyler Android App: https://play.google.com/store/apps/deta ... rts.fs1024
User avatar
Mattotone
Android Dev (Moderator)
Posts: 1238
Joined: July 10th, 2007, 5:30 pm
FreeStyler Version: BETA
I Use FreeStyler for: Just for the Fun of it.

Re: send command to FS from PHP

Post by Mattotone »

Also if its an urgent development the tcpip server is compatible with php,
The commands are differnt eg.
your example would simply be
ch 1 @ 255
Freestyler Addons www.120db.uk
Free Dropbox. 2GB account http://db.tt/J4c5G8C
$100 free credit @DigitalOcean Private Server: https://m.do.co/c/5c4a7c7d6693
Freestyler Android App: https://play.google.com/store/apps/deta ... rts.fs1024
samy_14
Knows how to turn Lights ON
Posts: 6
Joined: May 29th, 2011, 3:41 pm
FreeStyler Version: 3.3.2

Re: send command to FS from PHP

Post by samy_14 »

I just sent an email to Raph as you advice.

Can you explain more about the tcp/ip server ? I can't find it in the download area.

Thanks
User avatar
Mattotone
Android Dev (Moderator)
Posts: 1238
Joined: July 10th, 2007, 5:30 pm
FreeStyler Version: BETA
I Use FreeStyler for: Just for the Fun of it.

Re: send command to FS from PHP

Post by Mattotone »

Freestyler Addons www.120db.uk
Free Dropbox. 2GB account http://db.tt/J4c5G8C
$100 free credit @DigitalOcean Private Server: https://m.do.co/c/5c4a7c7d6693
Freestyler Android App: https://play.google.com/store/apps/deta ... rts.fs1024
samy_14
Knows how to turn Lights ON
Posts: 6
Joined: May 29th, 2011, 3:41 pm
FreeStyler Version: 3.3.2

Re: send command to FS from PHP

Post by samy_14 »

Thanks for this. It works perfectly with it.

For the moment I will use it until the answer of Raph. As I prefer to avoid things between my script and FS.
djsnipeeer
Knows how to turn Lights ON
Posts: 1
Joined: November 4th, 2016, 9:47 pm
FreeStyler Version: 3.6.3
I Use FreeStyler for: Nightclub Lighting

Re: send command to FS from PHP

Post by djsnipeeer »

Hi, i'm finding a way to remote freestyler in web browser for a very long time. I'm not php or C developer but when i find this post i become happy and i want to ask You if somebody of You can sand me some code or files trougt wich i can remote freestyler in web browser or on other pc . Thank U so much
Post Reply

Return to “FreeStyler 3rd Party Addons and utilities”