I am using Symfony Panther for web scraping (not testing) in a PHP project that does not use Symfony. I installed via Composer. Each time I need to scrape a link submitted by a user, I start a new Chrome Browser.
$client = Symfony\Component\Panther\Client::createChromeClient('/usr/bin/chromedriver');
$client->request('GET', $url);
$crawler = $client->waitFor('body');
Starting a new Chrome browser for each submitted $url is slow and resource intensive, so I want to keep the Chrome Client running on port 9515 and then each user's $url request can connect to that one same instance. Based on some user comments on Github, it sounds like a reasonable method:
- Spin up a Chrome instance on the Linux server, running on port 9515
- Make each url request connect to that instance.
I placed the first line i.e. with createChromeClient in a php script for a CRON job, but it never starts up the chrome client, and I get no errors either. Any ideas how to achieve this?