chrome-php / chrome

Instrument headless chrome/chromium instances from PHP
MIT License
2.25k stars 276 forks source link

Adding support for http endpoint in addition to the websocket #599

Open vrobert78 opened 8 months ago

vrobert78 commented 8 months ago

In order to use Chrome Headless you need to know the webSocketDebuggerUrl. This address can be retrieved by requesting /json/version as mentioned at https://chromedevtools.github.io/devtools-protocol/.

With this PR the goal is to support both the websocket address and the HTTP endpoint.

enricodias commented 8 months ago

Thanks for the contribution. I left some comments in the code. It also wouldn't hurt checking if curl is available before attempting to use it since this lib doesn't use it anywhere else and there are some styleci issues to be resolved.

vrobert78 commented 8 months ago

Hi @enricodias, thanks a lot for your feedback. I just committed a few changes from your recommendations.

enricodias commented 8 months ago

Some environments will prevent file functions from accessing external urls. I could just check if curl is available and use it.

vrobert78 commented 8 months ago

Some environments will prevent file functions from accessing external urls. I could just check if curl is available and use it.

Hey @enricodias , curl is back and I've added a check for it.