8

I found two way of setting proxy server one is through chrome web driver capabilities and the other one is directly setting while creating chrome client

$this->client = Client::createChromeClient(null, [
            '--proxy-server=socks://196.14.52.63:35048',
            '--headless',
            "--disable-gpu",
]);

but after setting proxy IP and port I get following error:

Curl error thrown for http POST to /session/cce06908d68a1e96bc6d1cb3b798aa14/url with params: {"url":"https:\/\/some-site\/login"}\n
Operation timed out after 30001 milliseconds with 0 bytes received

Basically I want to use proxy servers while scraping data using Symfony panther.

Stephan Vierkant
  • 9,674
  • 8
  • 61
  • 97
ahmed waleed
  • 477
  • 1
  • 4
  • 12
  • 1
    Did you make absolutely sure your proxy works with this config, e.g. by configuring it in a browser and trying manually? – ArSeN Jan 03 '20 at 22:03

2 Answers2

8

i made it work with passing following configuration.

$this->client = Client::createChromeClient(null, [
            '--window-size=1200,1100',
            "--proxy-server=http://ip:port",
            '--headless',
            "--disable-gpu",
]);

i think previously proxy server i was using doesn't support https (i was try to visit https page) and i was also missing windows-size argument.

ahmed waleed
  • 477
  • 1
  • 4
  • 12
0

Some times a proxy can take a long time to respond and the site you are trying to reach may be taking longer than 30sec. You can try increasing your time out like this:

Client::createChromeClient(base_path('drivers/chromedriver'), $args, ["port" => 9080, 'request_timeout_in_ms' => 100000]);
xslibx
  • 4,249
  • 9
  • 35
  • 52