Closed zerozh closed 6 years ago
It is definitely possible, yes. The problem is that there is no decent API available for PHP, therefore I'd need to write one which isn't really in the scope of this library. The guys from puppeteer have done an awesome job in wrapping all possible interactions down to the DevTools protocol, so the only advantage of repeating that for PHP would be to not be required to having Node installed on the server.
https://bugs.chromium.org/p/chromium/issues/detail?id=603559#c51
As developer said, arguments in DevTools will not to be migrated to command line arguments. I prefer to use puppeteer to send arguments like displayHeaderFooter
in printToPDF
instead of connect to DevTools via websocket.
Exactly, so one more reason to stick with DevTools and not use CLI of Chrome. What I don't understand is why you are using a Websocket at all? How is that related to Puppeteer and this library?
https://bugs.chromium.org/p/chromium/issues/detail?id=603559#c48
You could write a small wrapper script (in any language with a WebSockets library) to wrangle the DevTools commands.
So your solution is perfect.
All right, super.
It seems calling chrome directly from php code is possible. What is the pros and cons of using js as gateway?