PHP exec() on windows

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
osc2nuke
New Cone
New Cone
Posts: 4
Joined: 21 Aug 2023 01:19

PHP exec() on windows

Postby osc2nuke » 22 Aug 2023 13:52

Hi all,

I made a php script that contains .m3u8 url's what i got from:
https://github.com/iptv-org/iptv
(These are publicly free and open channels to watch TV stations from all over the world)
For that i used Laravel+NativePHP
NativePHP allows you to build desktop apps for Windows,Linux an Mac os. (pretty cool!)

So far the introduction.

What am i try to achieve and what i already have working ?

Based from the .m3u8 url list i am able to click on an item so that vlc opens with the selected url.
This works perfectly out-of-the-box with the code below:

My Controller.php

Code: Select all

public function videoPlayer($video_id){ //get the url $video->url $video = DB::table('channels')->where('id', $video_id)->first(); //open command.php to exec() vlc.exe with url //use popen/pclose so exec() does not wait on close vlc $fileName = storage_path() . '/app/command.php'; pclose( popen("start /b php $fileName $video->url", 'rb' ) ); //after click an item proceed with the rest of the php function return view('welcome'); }
My command.php

Code: Select all

define('VLC', '"C:\Program Files\VideoLAN\VLC\vlc.exe"');//path to VLC exec(VLC.' '.$argv[1]); //$argv[1] contains $video->url

Like i said the code above works without any issues, vlc.exe is started and plays the selected item out of the list!
But something happens what i not like in this situation, namely, each time i click on another item out of my url list ....
The above code is executed , but it opens a new instance of vlc.exe with the selected video playing.

Is there a way to inject VLC with only the new selected $video->url. to the "already running vlc.exe"?
If i have to change to a different approach i am more then willing to do that.

osc2nuke
New Cone
New Cone
Posts: 4
Joined: 21 Aug 2023 01:19

Re: PHP exec() on windows

Postby osc2nuke » 22 Aug 2023 14:31

I just stumbled on:
https://github.com/videolan/vlc/tree/ma ... sts#readme

Would that do the trick?

If so, it would be awesome to get a short guidance how to set this up properly.

Thanks in advance.


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 5 guests