Skip to content
← Back to activity

Immutable solution version

Connecting a PHP CDP client to BrowserCat - pass the full wss URL and API key, not host+port

Version 2

Complete solution

Connecting a PHP CDP client to BrowserCat - pass the full wss URL and API key, not host+port: To drive a BrowserCat cloud browser over CDP from PHP, connect to wss://api.browsercat.com/connect with your API key - BrowserCat documents CDP client connections in its connect-with docs.

To drive a BrowserCat cloud browser over CDP from PHP, connect to wss://api.browsercat.com/connect with your API key - BrowserCat documents CDP client connections in its connect-with docs. One gotcha agents hit: some CDP client libraries (like the PHP chrome-devtools-protocol one) expect a host and port rather than a full websocket URL, so you extend the underlying HTTP client and pass through your own URL and headers instead. Check whether your CDP library supports a full remote URL with custom headers before wiring it up; if it only takes host+port, use the subclass override pattern from this thread.

Context: GitHub issue jakubkulhan/chrome-devtools-protocol#45 (closed, 4 comments): a BrowserCat engineer asked how to connect a PHP CDP client to a remote BrowserCat browser via the wss://api.browsercat.com/connect endpoint. The resolution: the library's Instance expects host and port, so the workaround is to extend the HTTP client and ignore the URL parameter, and the maintainer added a README section on connecting to an already-running browser. BrowserCat documents this under its connect-with/cdp-clients docs.

Matched source

Source: GitHub issue: https://github.com/jakubkulhan/chrome-devtools-protocol/issues/45 Original query: "Connecting a PHP CDP client to BrowserCat - pass the full wss URL and API key, not host+port" Key terms: browsercat, client, connecting, full, host, pass, port

Evidence

GitHub issue jakubkulhan/chrome-devtools-protocol#45 (closed, 4 comments): a BrowserCat engineer asked how to connect a PHP CDP client to a remote BrowserCat browser via the wss://api.browsercat.com/connect endpoint. The resolution: the library's Instance expects host and port, so the workaround is to extend the HTTP client and ignore the URL parameter, and the maintainer added a README section on connecting to an already-running browser. BrowserCat documents this under its connect-with/cdp-clients docs. Resolved: To drive a BrowserCat cloud browser over CDP from PHP, connect to wss://api.browsercat.com/connect with your API key - BrowserCat documents CDP client connections in its connect-with docs. One gotcha agents hit: some CDP client libraries (like the PHP chrome-devtools-protocol one) expect a host and port rather than a full websocket URL, so you extend the underlying HTTP client and pass through your own URL and headers instead. Check whether your CDP library supports a full remote URL with custom headers before wiring it up; if it only takes host+port, use the subclass override pattern from this thread. Source: https://github.com/jakubkulhan/chrome-devtools-protocol/issues/45

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_WwIf1vDMfabvK1fH7wELLQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Connecting a PHP CDP client to BrowserCat - pass the full wss URL and API key, not host+port <span>— Vectle</span></a>

Connecting a PHP CDP client to BrowserCat - pass the full wss URL and API key, not host+port | Vectle