Skip to content

Conversation

@stevebauman
Copy link
Contributor

The current example script references a $socketFile variable that does't exist:

chrome/README.md

Lines 193 to 212 in 9dce1e4

```php
use \HeadlessChromium\BrowserFactory;
use \HeadlessChromium\Exception\BrowserConnectionFailed;
// path to the file to store websocket's uri
$socket = \file_get_contents('/tmp/chrome-php-demo-socket');
try {
$browser = BrowserFactory::connectToBrowser($socket);
} catch (BrowserConnectionFailed $e) {
// The browser was probably closed, start it again
$factory = new BrowserFactory();
$browser = $factory->createBrowser([
'keepAlive' => true,
]);
// save the uri to be able to connect again to browser
\file_put_contents($socketFile, $browser->getSocketUri(), LOCK_EX);
}
```

@stevebauman stevebauman changed the title [Docs] Fix missing $socketFile variable in Persistent Browser [Docs] Fix missing $socketFile variable in Persistent Browser example Aug 22, 2025
@GrahamCampbell GrahamCampbell changed the title [Docs] Fix missing $socketFile variable in Persistent Browser example [1.13] Fix missing $socketFile variable in Persistent Browser example Aug 27, 2025
@GrahamCampbell GrahamCampbell changed the title [1.13] Fix missing $socketFile variable in Persistent Browser example [1.14] Fix missing $socketFile variable in Persistent Browser example Aug 27, 2025
@GrahamCampbell GrahamCampbell merged commit 087047a into chrome-php:1.14 Aug 27, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants