Answer the question
In order to leave comments, you need to log in
How to use proxy in ReactPHP?
There is a problem, I use reactPHP to parse the site, but it became necessary to use a proxy server, in case of blocking, how to do this?
I'm trying to use this lib https://github.com/clue/reactphp-socks
Example:
$proxy = new SocksClient('89.32.68.50:3128', new Connector($loop));
$connector = new Connector($loop, array(
'tcp' => $proxy,
'dns' => false
));
$browser = new Browser($loop, $connector);
$browser->get('http://yandex.ru')->then(function (ResponseInterface $response) {
echo Psr7\str($response);
}, function ($event){
echo (string)$event;
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question