How to use proxy authentication with Goutte? How to use proxy authentication with Goutte? php php

How to use proxy authentication with Goutte?


Have you tried to instantiate your Client with the proxy options directly?

Like this:

$url = 'http://whatismyip.org';$client = new Client($url, array(    'version'        => 'v1.1',    'request.options' => array(        'auth'    => array('d80fe9ebasab73d21a4', '', 'Basic'),        'proxy'   => 'tcp://@x.x.x.x:8010'    )));$crawler = $client->request('GET', $url);$status = $client->getResponse()->getStatus();echo $status; // 407


$config = [    'proxy' => [        'http' => 'xx.xx.xx.xx:8080'    ]];$client = new Client($config);$client->setAuth('username', 'password', 'basic');$crawler = $client->request('GET', $url);$status = $client->getResponse()->getStatus();echo $status;

I suppose it's a client configuration, not a request parameter.