0

I have a puppeteer progam that I execute by entering c:\myProgram>node index.js in the command prompt. Instead of entering this in the command prompt, I would like to have the command run from my PHP program.
Something like this pseudo-code:

When button is clicked,
   call function

Where the function will enter the command in the command prompt for me. I am using Visual Studio Code and the integrated terminal could be used instead (I think).

What code could replace call fucntion in my example?

hardkoded
  • 15,907
  • 3
  • 45
  • 56
JULIE_0420
  • 31
  • 4

1 Answers1

0

You need to use exec(), system() or passthru() functions.

There's another SO post with details on all 3. Personally I prefer passthru()

exec() vs system() vs passthru()

And a slightly more advance usage of passthru() here, depends on what you need you should be covered with those two links.

passthru() vs shell_exec()

Dharman
  • 26,923
  • 21
  • 73
  • 125
Oliver M Grech
  • 2,854
  • 1
  • 19
  • 31