How can i set proxy server with symfony/panther

半世苍凉 提交于 2020-01-24 09:12:16

问题


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 scrapping data using Symfony panther.


回答1:


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.



来源:https://stackoverflow.com/questions/59583732/how-can-i-set-proxy-server-with-symfony-panther

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!